Add IS_MISSING_FILE(statbuf) macro.
authorWayne Davison <wayned@samba.org>
Sun, 19 Jan 2014 20:23:39 +0000 (12:23 -0800)
committerWayne Davison <wayned@samba.org>
Sun, 19 Jan 2014 20:23:39 +0000 (12:23 -0800)
flist.c
rsync.h

diff --git a/flist.c b/flist.c
index bf8d124b6f9af2b4b2982242972e572e769137f1..a3467776bbd234fab096e7df783e5146094dc4cb 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -1156,7 +1156,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
        if (sanitize_paths)
                sanitize_path(thisname, thisname, "", 0, SP_DEFAULT);
 
-       if (stp && (S_ISDIR(stp->st_mode) || stp->st_mode == 0)) {
+       if (stp && (S_ISDIR(stp->st_mode) || IS_MISSING_FILE(*stp))) {
                /* This is needed to handle a "symlink/." with a --relative
                 * dir, or a request to delete a specific file. */
                st = *stp;
@@ -1200,7 +1200,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                                full_fname(thisname));
                }
                return NULL;
-       } else if (st.st_mode == 0) {
+       } else if (IS_MISSING_FILE(st)) {
                io_error |= IOERR_GENERAL;
                rprintf(FINFO, "skipping file with bogus (zero) st_mode: %s\n",
                        full_fname(thisname));
@@ -2290,7 +2290,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
                                } else
                                        fn = p;
                                send_implied_dirs(f, flist, fbuf, fbuf, p, flags,
-                                                 st.st_mode == 0 ? MISSING_NAME : name_type);
+                                                 IS_MISSING_FILE(st) ? MISSING_NAME : name_type);
                                if (fn == p)
                                        continue;
                        }
diff --git a/rsync.h b/rsync.h
index fcb4c267933d482d8d87370f99ce17e2ebb74c60..b2869d0459554dce4856685fff0ddca5a9dc88dc 100644 (file)
--- a/rsync.h
+++ b/rsync.h
@@ -787,6 +787,8 @@ extern int xattrs_ndx;
 #define DIR_FIRST_CHILD(a) (a)[1]
 #define DIR_NEXT_SIBLING(a) (a)[2]
 
+#define IS_MISSING_FILE(statbuf) ((statbuf).st_mode == 0)
+
 /*
  * Start the flist array at FLIST_START entries and grow it
  * by doubling until FLIST_LINEAR then grow by FLIST_LINEAR