now print error if chdir fails

This commit is contained in:
Todd C. Miller
1994-08-01 17:39:53 +00:00
parent 3c318d8ae4
commit 35d838c688

View File

@@ -208,7 +208,11 @@ static void realpath_restore(cwd)
/* relinquish root privs and chdir to where we started... */ /* relinquish root privs and chdir to where we started... */
be_user(); 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; errno = old_errno;
} }