]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Don't call memcmp() on an empty lastdir.
authorWayne Davison <wayne@opencoder.net>
Mon, 9 Jan 2023 05:35:39 +0000 (21:35 -0800)
committerWayne Davison <wayne@opencoder.net>
Mon, 9 Jan 2023 05:35:39 +0000 (21:35 -0800)
flist.c

diff --git a/flist.c b/flist.c
index 65b459b1712be7c88f5498b77b43a8955e70a817..4eb672f1c7a432cd5e5e88cb9500e5a1468ba9e7 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -2367,7 +2367,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
                }
 
                dirlen = dir ? strlen(dir) : 0;
-               if (dirlen != lastdir_len || memcmp(lastdir, dir, dirlen) != 0) {
+               if (dirlen != lastdir_len || (dirlen && memcmp(lastdir, dir, dirlen) != 0)) {
                        if (!change_pathname(NULL, dir, -dirlen))
                                goto bad_path;
                        lastdir = pathname;