diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2019-02-16 16:25:46 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2019-02-16 16:25:46 +0000 |
commit | e92e865b83433e351604ed0a6b85232e2ed77dde (patch) | |
tree | a3ce64fa7e2992ad6a5cfd8923012d35708b06b2 /usr.bin | |
parent | 2cf49967293dd01cb92500ca0ad4b503a6cf6239 (diff) |
We need to send/receive the rdev after gid and before symlink.
From kristaps, thanks!
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/rsync/flist.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/usr.bin/rsync/flist.c b/usr.bin/rsync/flist.c index 3a36c306f30..69abbf41cfd 100644 --- a/usr.bin/rsync/flist.c +++ b/usr.bin/rsync/flist.c @@ -1,4 +1,4 @@ -/* $Id: flist.c,v 1.16 2019/02/16 10:49:37 florian Exp $ */ +/* $Id: flist.c,v 1.17 2019/02/16 16:25:45 florian Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Florian Obser <florian@openbsd.org> @@ -346,6 +346,18 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl, } } + /* Conditional part: devices & special files. */ + + if ((sess->opts->devices && (S_ISBLK(f->st.mode) || + S_ISCHR(f->st.mode))) || + (sess->opts->specials && (S_ISFIFO(f->st.mode) || + S_ISSOCK(f->st.mode)))) { + if (!io_write_int(sess, fdout, f->st.rdev)) { + ERRX1(sess, "io_write_int"); + goto out; + } + } + /* Conditional part: link. */ if (S_ISLNK(f->st.mode) && @@ -362,14 +374,6 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl, } } - if (S_ISBLK(f->st.mode) || S_ISCHR(f->st.mode) || - S_ISFIFO(f->st.mode) || S_ISSOCK(f->st.mode)) { - if (!io_write_int(sess, fdout, f->st.rdev)) { - ERRX1(sess, "io_write_int"); - goto out; - } - } - if (S_ISREG(f->st.mode)) sess->total_size += f->st.size; } @@ -682,10 +686,10 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) ff->st.gid = fflast->st.gid; } - /* handle devices & special files*/ + /* Conditional part: devices & special files. */ if ((sess->opts->devices && (S_ISBLK(ff->st.mode) || - S_ISCHR(ff->st.mode))) || + S_ISCHR(ff->st.mode))) || (sess->opts->specials && (S_ISFIFO(ff->st.mode) || S_ISSOCK(ff->st.mode)))) { if (!(FLIST_RDEV_SAME & flag)) { @@ -695,7 +699,7 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) } ff->st.rdev = ival; } else if (fflast == NULL) { - ERRX(sess, "same mode without last entry"); + ERRX(sess, "same device without last entry"); goto out; } else ff->st.rdev = fflast->st.rdev; |