=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/flist.c,v retrieving revision 1.37 retrieving revision 1.38 diff -c -r1.37 -r1.38 *** src/usr.bin/rsync/flist.c 2022/12/26 19:16:02 1.37 --- src/usr.bin/rsync/flist.c 2023/12/27 17:22:25 1.38 *************** *** 1,4 **** ! /* $OpenBSD: flist.c,v 1.37 2022/12/26 19:16:02 jmc Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * Copyright (c) 2019 Florian Obser --- 1,4 ---- ! /* $OpenBSD: flist.c,v 1.38 2023/12/27 17:22:25 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * Copyright (c) 2019 Florian Obser *************** *** 442,448 **** * than byte-size. */ ! if (FLIST_NAME_SAME & flags) { if (!io_read_byte(sess, fd, &bval)) { ERRX1("io_read_byte"); return 0; --- 442,448 ---- * than byte-size. */ ! if (flags & FLIST_NAME_SAME) { if (!io_read_byte(sess, fd, &bval)) { ERRX1("io_read_byte"); return 0; *************** *** 452,458 **** /* Get the (possibly-remaining) filename length. */ ! if (FLIST_NAME_LONG & flags) { if (!io_read_size(sess, fd, &pathlen)) { ERRX1("io_read_size"); return 0; --- 452,458 ---- /* Get the (possibly-remaining) filename length. */ ! if (flags & FLIST_NAME_LONG) { if (!io_read_size(sess, fd, &pathlen)) { ERRX1("io_read_size"); return 0; *************** *** 479,485 **** } f->path[len] = '\0'; ! if (FLIST_NAME_SAME & flags) memcpy(f->path, last, partial); if (!io_read_buf(sess, fd, f->path + partial, pathlen)) { --- 479,485 ---- } f->path[len] = '\0'; ! if (flags & FLIST_NAME_SAME) memcpy(f->path, last, partial); if (!io_read_buf(sess, fd, f->path + partial, pathlen)) { *************** *** 633,676 **** /* Read the modification time. */ ! if (!(FLIST_TIME_SAME & flag)) { if (!io_read_uint(sess, fd, &uival)) { ERRX1("io_read_uint"); goto out; } ff->st.mtime = uival; /* beyond 2038 */ } else if (fflast == NULL) { ! ERRX("same time without last entry"); ! goto out; } else ff->st.mtime = fflast->st.mtime; /* Read the file mode. */ ! if (!(FLIST_MODE_SAME & flag)) { if (!io_read_uint(sess, fd, &uival)) { ERRX1("io_read_uint"); goto out; } ff->st.mode = uival; } else if (fflast == NULL) { ! ERRX("same mode without last entry"); ! goto out; } else ff->st.mode = fflast->st.mode; /* Conditional part: uid. */ if (sess->opts->preserve_uids) { ! if (!(FLIST_UID_SAME & flag)) { if (!io_read_uint(sess, fd, &uival)) { ERRX1("io_read_int"); goto out; } ff->st.uid = uival; } else if (fflast == NULL) { ! ERRX("same uid without last entry"); ! goto out; } else ff->st.uid = fflast->st.uid; } --- 633,673 ---- /* Read the modification time. */ ! if (!(flag & FLIST_TIME_SAME)) { if (!io_read_uint(sess, fd, &uival)) { ERRX1("io_read_uint"); goto out; } ff->st.mtime = uival; /* beyond 2038 */ } else if (fflast == NULL) { ! ff->st.mtime = 0; } else ff->st.mtime = fflast->st.mtime; /* Read the file mode. */ ! if (!(flag & FLIST_MODE_SAME)) { if (!io_read_uint(sess, fd, &uival)) { ERRX1("io_read_uint"); goto out; } ff->st.mode = uival; } else if (fflast == NULL) { ! ff->st.mode = 0; } else ff->st.mode = fflast->st.mode; /* Conditional part: uid. */ if (sess->opts->preserve_uids) { ! if (!(flag & FLIST_UID_SAME)) { if (!io_read_uint(sess, fd, &uival)) { ERRX1("io_read_int"); goto out; } ff->st.uid = uival; } else if (fflast == NULL) { ! ff->st.uid = 0; } else ff->st.uid = fflast->st.uid; } *************** *** 678,692 **** /* Conditional part: gid. */ if (sess->opts->preserve_gids) { ! if (!(FLIST_GID_SAME & flag)) { if (!io_read_uint(sess, fd, &uival)) { ERRX1("io_read_uint"); goto out; } ff->st.gid = uival; } else if (fflast == NULL) { ! ERRX("same gid without last entry"); ! goto out; } else ff->st.gid = fflast->st.gid; } --- 675,688 ---- /* Conditional part: gid. */ if (sess->opts->preserve_gids) { ! if (!(flag & FLIST_GID_SAME)) { if (!io_read_uint(sess, fd, &uival)) { ERRX1("io_read_uint"); goto out; } ff->st.gid = uival; } else if (fflast == NULL) { ! ff->st.gid = 0; } else ff->st.gid = fflast->st.gid; } *************** *** 697,711 **** S_ISCHR(ff->st.mode))) || (sess->opts->specials && (S_ISFIFO(ff->st.mode) || S_ISSOCK(ff->st.mode)))) { ! if (!(FLIST_RDEV_SAME & flag)) { if (!io_read_int(sess, fd, &ival)) { ERRX1("io_read_int"); goto out; } ff->st.rdev = ival; } else if (fflast == NULL) { ! ERRX("same device without last entry"); ! goto out; } else ff->st.rdev = fflast->st.rdev; } --- 693,706 ---- S_ISCHR(ff->st.mode))) || (sess->opts->specials && (S_ISFIFO(ff->st.mode) || S_ISSOCK(ff->st.mode)))) { ! if (!(flag & FLIST_RDEV_SAME)) { if (!io_read_int(sess, fd, &ival)) { ERRX1("io_read_int"); goto out; } ff->st.rdev = ival; } else if (fflast == NULL) { ! ff->st.rdev = 0; } else ff->st.rdev = fflast->st.rdev; }