summaryrefslogtreecommitdiff
path: root/sudo_realpath.c
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@courtesan.com>1994-08-01 17:39:53 +0000
committerTodd C. Miller <Todd.Miller@courtesan.com>1994-08-01 17:39:53 +0000
commitfa34d10fb9d178c05867478630b1d3fc2ca8e20b (patch)
tree176230c9837b036cf9169c46764bbfed3f17604f /sudo_realpath.c
parent2fb8f9ae49640e90bcd3364a01d269bc658945ea (diff)
downloadsudo-fa34d10fb9d178c05867478630b1d3fc2ca8e20b.tar.gz
now print error if chdir fails
Diffstat (limited to 'sudo_realpath.c')
-rw-r--r--sudo_realpath.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sudo_realpath.c b/sudo_realpath.c
index 76b8041a4..060f13bf4 100644
--- a/sudo_realpath.c
+++ b/sudo_realpath.c
@@ -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;
}