aboutsummaryrefslogtreecommitdiff
path: root/libbb/xfuncs_printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/xfuncs_printf.c')
-rw-r--r--libbb/xfuncs_printf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index aae3b092d..a9add8ab2 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -417,11 +417,18 @@ void FAST_FUNC xseteuid(uid_t euid)
417 if (seteuid(euid)) bb_simple_perror_msg_and_die("seteuid"); 417 if (seteuid(euid)) bb_simple_perror_msg_and_die("seteuid");
418} 418}
419 419
420int FAST_FUNC chdir_or_warn(const char *path)
421{
422 int r = chdir(path);
423 if (r != 0)
424 bb_perror_msg("can't change directory to '%s'", path);
425 return r;
426}
420// Die if we can't chdir to a new path. 427// Die if we can't chdir to a new path.
421void FAST_FUNC xchdir(const char *path) 428void FAST_FUNC xchdir(const char *path)
422{ 429{
423 if (chdir(path)) 430 if (chdir_or_warn(path) != 0)
424 bb_perror_msg_and_die("can't change directory to '%s'", path); 431 xfunc_die();
425} 432}
426 433
427void FAST_FUNC xfchdir(int fd) 434void FAST_FUNC xfchdir(int fd)