aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 18:39:58 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 18:39:58 +0000
commitd9cf7ac781c1274d6d23fa5674b6b90baaf4cf61 (patch)
treec7e395cfe1eafcd601bc16e0231fc30f8789e4d9 /miscutils
parent67f641e75b685abe1588b634b409c1ee2ff68c22 (diff)
downloadbusybox-d9cf7ac781c1274d6d23fa5674b6b90baaf4cf61.tar.gz
- patch from Denis Vlasenko to add and use bb_xchdir()
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/crond.c4
-rw-r--r--miscutils/crontab.c9
-rw-r--r--miscutils/makedevs.c18
3 files changed, 12 insertions, 19 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 06b8769fa..4d479bc0d 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -197,9 +197,7 @@ int crond_main(int ac, char **av)
* change directory
*/
- if (chdir(CDir) != 0) {
- bb_perror_msg_and_die("%s", CDir);
- }
+ bb_xchdir(CDir);
signal(SIGHUP, SIG_IGN); /* hmm.. but, if kill -HUP original
* version - his died. ;(
*/
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 @@
+/* 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);
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 999b99331..24d07ebe0 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -1,4 +1,11 @@
/* vi: set sw=4 ts=4: */
+/*
+ * public domain -- Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
+ *
+ * makedevs
+ * Make ranges of device files quickly.
+ * known bugs: can't deal with alpha ranges
+ */
#include <stdio.h>
#include <stdlib.h>
@@ -12,13 +19,6 @@
#include "busybox.h"
#ifdef CONFIG_FEATURE_MAKEDEVS_LEAF
-/*
- * public domain -- Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
- *
- * makedevs
- * Make ranges of device files quickly.
- * known bugs: can't deal with alpha ranges
- */
int makedevs_main(int argc, char **argv)
{
mode_t mode;
@@ -94,9 +94,7 @@ int makedevs_main(int argc, char **argv)
bb_error_msg_and_die("root directory not specified");
}
- if (chdir(rootdir) != 0) {
- bb_perror_msg_and_die("could not chdir to %s", rootdir);
- }
+ bb_xchdir(rootdir);
umask(0);