aboutsummaryrefslogtreecommitdiff
path: root/miscutils/crontab.c
diff options
context:
space:
mode:
authoraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-04-12 18:39:58 +0000
committeraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-04-12 18:39:58 +0000
commit173133414753125e4a5ddf160cd22807a703bd38 (patch)
treec7e395cfe1eafcd601bc16e0231fc30f8789e4d9 /miscutils/crontab.c
parent04f8875fd522ea63205b3e223d56979117245d1f (diff)
downloadbusybox-w32-173133414753125e4a5ddf160cd22807a703bd38.tar.gz
busybox-w32-173133414753125e4a5ddf160cd22807a703bd38.tar.bz2
busybox-w32-173133414753125e4a5ddf160cd22807a703bd38.zip
- patch from Denis Vlasenko to add and use bb_xchdir()
git-svn-id: svn://busybox.net/trunk/busybox@14837 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 df94c855a..703d01ecc 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -1,3 +1,4 @@
1/* vi: set sw=4 ts=4: */
1/* 2/*
2 * CRONTAB 3 * CRONTAB
3 * 4 *
@@ -148,8 +149,7 @@ crontab_main(int ac, char **av)
148 * Change directory to our crontab directory 149 * Change directory to our crontab directory
149 */ 150 */
150 151
151 if (chdir(CDir) < 0) 152 bb_xchdir(CDir);
152 bb_perror_msg_and_die("cannot change dir to %s", CDir);
153 153
154 /* 154 /*
155 * Handle options as appropriate 155 * Handle options as appropriate
@@ -358,10 +358,7 @@ ChangeUser(const char *user, short dochdir)
358 if (dochdir) { 358 if (dochdir) {
359 if (chdir(pas->pw_dir) < 0) { 359 if (chdir(pas->pw_dir) < 0) {
360 bb_perror_msg("chdir failed: %s %s", user, pas->pw_dir); 360 bb_perror_msg("chdir failed: %s %s", user, pas->pw_dir);
361 if (chdir(TMPDIR) < 0) { 361 bb_xchdir(TMPDIR);
362 bb_perror_msg_and_die("chdir failed: %s %s", user, TMPDIR);
363 return(-1);
364 }
365 } 362 }
366 } 363 }
367 return(pas->pw_uid); 364 return(pas->pw_uid);