Got rid of the erroneous --dry-run short-circuit in the directory
authorWayne Davison <wayned@samba.org>
Thu, 20 Jan 2005 22:59:54 +0000 (22:59 +0000)
committerWayne Davison <wayned@samba.org>
Thu, 20 Jan 2005 22:59:54 +0000 (22:59 +0000)
handling.

generator.c

index 7d60f64..8c786e7 100644 (file)
@@ -292,18 +292,15 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
                 * to prepare appropriately.  If there is already a
                 * file of that name and it is *not* a directory, then
                 * we need to delete it.  If it doesn't exist, then
-                * recursively create it. */
-
-               if (dry_run)
-                       return; /* TODO: causes inaccuracies -- fix */
+                * (perhaps recursively) create it. */
                if (statret == 0 && !S_ISDIR(st.st_mode)) {
                        delete_file(fname, DEL_TERSE);
                        statret = -1;
                }
                if (statret != 0 && do_mkdir(fname,file->mode) != 0 && errno != EEXIST) {
-                       if (!(relative_paths && errno == ENOENT
-                           && create_directory_path(fname, orig_umask) == 0
-                           && do_mkdir(fname, file->mode) == 0)) {
+                       if (!relative_paths || errno != ENOENT
+                           || create_directory_path(fname, orig_umask) < 0
+                           || do_mkdir(fname, file->mode) < 0) {
                                rsyserr(FERROR, errno,
                                        "recv_generator: mkdir %s failed",
                                        full_fname(fname));