about summary refs log tree commit diff
path: root/Src/Modules/files.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Modules/files.c')
-rw-r--r--Src/Modules/files.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Src/Modules/files.c b/Src/Modules/files.c
index f22b23fb7..0b991c556 100644
--- a/Src/Modules/files.c
+++ b/Src/Modules/files.c
@@ -428,7 +428,8 @@ recursivecmd(char *nam, int opt_noerr, int opt_recurse, int opt_safe,
     if ((err & 2) && ds.dirfd >= 0 && restoredir(&ds) && zchdir(pwd)) {
 	zsfree(pwd);
 	pwd = ztrdup("/");
-	chdir(pwd);
+	if (chdir(pwd) < 0)
+	    zwarn("failed to chdir(%s): %e", pwd, errno);
     }
     if (ds.dirfd >= 0)
 	close(ds.dirfd);