]> granicus.if.org Git - sudo/commitdiff
now print error if chdir fails
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 1 Aug 1994 17:39:53 +0000 (17:39 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 1 Aug 1994 17:39:53 +0000 (17:39 +0000)
sudo_realpath.c

index 76b8041a40b7c17136fba16f6740ebe9d67aaabc..060f13bf453a2ae54aa916d45c409a46750e9c65 100644 (file)
@@ -208,7 +208,11 @@ static void realpath_restore(cwd)
 
     /* relinquish root privs and chdir to where we started... */
     be_user();
-    (void) chdir(cwd);
+    if (chdir(cwd)) {
+       fprintf(stderr, "Error: cannot change dir back to %s, sudo aborting!\n",
+                       cwd);
+       exit(1);
+    }
 
     errno = old_errno;
 }