X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/30f337c9ef4c1e59f306688cd74f1a3f82b9c6f8..0c42946536087bc2caa4d5d1fe4569c7c097c941:/flist.c diff --git a/flist.c b/flist.c index 9b7dcf5e..f1b054f5 100644 --- a/flist.c +++ b/flist.c @@ -357,7 +357,7 @@ static void send_file_entry(struct file_struct *file, int f, unsigned short flags; static time_t modtime; static mode_t mode; - static DEV64_T last_rdev; + static DEV64_T rdev; /* just high bytes after p28 */ static uid_t uid; static gid_t gid; static DEV64_T dev; @@ -385,19 +385,19 @@ static void send_file_entry(struct file_struct *file, int f, mode = file->mode; if (preserve_devices) { if (protocol_version < 28) { - if (IS_DEVICE(mode) && file->rdev == last_rdev) { + if (IS_DEVICE(mode) && file->rdev == rdev) { /* Set both flags so that the test when * writing the data is simpler. */ flags |= SAME_RDEV_pre28|SAME_HIGH_RDEV; } else - last_rdev = file->rdev; + rdev = file->rdev; } else if (IS_DEVICE(mode)) { - if ((file->rdev & ~0xFF) == last_rdev) + if ((file->rdev & ~0xFF) == rdev) flags |= SAME_HIGH_RDEV; else - last_rdev = file->rdev & ~0xFF; + rdev = file->rdev & ~0xFF; } } if (file->uid == uid) @@ -470,7 +470,8 @@ static void send_file_entry(struct file_struct *file, int f, write_int(f, gid); } if (preserve_devices && IS_DEVICE(mode)) { - /* If SAME_HIGH_RDEV is off, SAME_RDEV_pre28 is also off. */ + /* If SAME_HIGH_RDEV is off, SAME_RDEV_pre28 is also off. + * Also, avoid using "rdev" because it may be incomplete. */ if (!(flags & SAME_HIGH_RDEV)) write_int(f, file->rdev); else if (protocol_version >= 28) @@ -519,7 +520,7 @@ static void receive_file_entry(struct file_struct **fptr, { static time_t modtime; static mode_t mode; - static DEV64_T rdev; + static DEV64_T rdev; /* just high bytes after p28 */ static uid_t uid; static gid_t gid; static DEV64_T dev; @@ -613,7 +614,7 @@ static void receive_file_entry(struct file_struct **fptr, file->rdev = (DEV64_T)read_int(f); rdev = file->rdev & ~0xFF; } else - file->rdev = (DEV64_T)(rdev | read_byte(f)); + file->rdev = rdev | (DEV64_T)read_byte(f); } }