summaryrefslogtreecommitdiff
path: root/miscutils/crontab.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-04-12 18:39:58 +0000
committerBernhard Reutner-Fischer2006-04-12 18:39:58 +0000
commitd9cf7ac781c1274d6d23fa5674b6b90baaf4cf61 (patch)
treec7e395cfe1eafcd601bc16e0231fc30f8789e4d9 /miscutils/crontab.c
parent67f641e75b685abe1588b634b409c1ee2ff68c22 (diff)
downloadbusybox-d9cf7ac781c1274d6d23fa5674b6b90baaf4cf61.zip
busybox-d9cf7ac781c1274d6d23fa5674b6b90baaf4cf61.tar.gz
- patch from Denis Vlasenko to add and use bb_xchdir()
Diffstat (limited to 'miscutils/crontab.c')
-rw-r--r--miscutils/crontab.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index df94c85..703d01e 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/*
* CRONTAB
*
@@ -148,8 +149,7 @@ crontab_main(int ac, char **av)
* Change directory to our crontab directory
*/
- if (chdir(CDir) < 0)
- bb_perror_msg_and_die("cannot change dir to %s", CDir);
+ bb_xchdir(CDir);
/*
* Handle options as appropriate
@@ -358,10 +358,7 @@ ChangeUser(const char *user, short dochdir)
if (dochdir) {
if (chdir(pas->pw_dir) < 0) {
bb_perror_msg("chdir failed: %s %s", user, pas->pw_dir);
- if (chdir(TMPDIR) < 0) {
- bb_perror_msg_and_die("chdir failed: %s %s", user, TMPDIR);
- return(-1);
- }
+ bb_xchdir(TMPDIR);
}
}
return(pas->pw_uid);