[PATCH] Don't fail if current directory doesn't exists

> pzhukov at redhat.com
Wed Feb 21 19:53:17 UTC 2018


It's possible to have situation when current directory is not needed for
rsync operation (using absolute path on lazy mounts / being in deleted directory).
rsync should not fail in such cases
---
 util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/util.c b/util.c
index 8723248f..33107867 100644
--- a/util.c
+++ b/util.c
@@ -1090,8 +1090,8 @@ int change_dir(const char *dir, int set_path_only)
 	if (!initialised) {
 		initialised = 1;
 		if (getcwd(curr_dir, sizeof curr_dir - 1) == NULL) {
-			rsyserr(FERROR, errno, "getcwd()");
-			exit_cleanup(RERR_FILESELECT);
+			// current dir is unavailable using "/" instead
+			strcpy(curr_dir, "/");
 		}
 		curr_dir_len = strlen(curr_dir);
 	}
-- 
2.14.3




More information about the rsync mailing list