Move the initialization of push_dir, which calls getcwd, to early in main.
[rsync/rsync.git] / util.c
diff --git a/util.c b/util.c
index cadf3eb..16d8f6c 100644 (file)
--- a/util.c
+++ b/util.c
@@ -638,6 +638,8 @@ char *push_dir(char *dir, int save)
                getcwd(curr_dir, sizeof(curr_dir)-1);
        }
 
+       if (!dir) return NULL; /* this call was probably just to initialize */
+
        if (chdir(dir)) return NULL;
 
        if (save) {