diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-12 18:39:58 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-12 18:39:58 +0000 |
commit | 173133414753125e4a5ddf160cd22807a703bd38 (patch) | |
tree | c7e395cfe1eafcd601bc16e0231fc30f8789e4d9 /libbb | |
parent | 04f8875fd522ea63205b3e223d56979117245d1f (diff) | |
download | busybox-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 'libbb')
-rw-r--r-- | libbb/Makefile.in | 2 | ||||
-rw-r--r-- | libbb/bb_xchdir.c | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/libbb/Makefile.in b/libbb/Makefile.in index f05bf80ed..eac14c60c 100644 --- a/libbb/Makefile.in +++ b/libbb/Makefile.in | |||
@@ -30,7 +30,7 @@ LIBBB-y:= \ | |||
30 | trim.c u_signal_names.c vdprintf.c verror_msg.c \ | 30 | trim.c u_signal_names.c vdprintf.c verror_msg.c \ |
31 | vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c xstat.c \ | 31 | vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c xstat.c \ |
32 | xgethostbyname.c xgethostbyname2.c xreadlink.c xregcomp.c xgetlarg.c \ | 32 | xgethostbyname.c xgethostbyname2.c xreadlink.c xregcomp.c xgetlarg.c \ |
33 | bb_xsocket.c bb_xdaemon.c bb_xbind.c bb_xlisten.c \ | 33 | bb_xsocket.c bb_xdaemon.c bb_xbind.c bb_xlisten.c bb_xchdir.c \ |
34 | get_terminal_width_height.c fclose_nonstdin.c fflush_stdout_and_exit.c \ | 34 | get_terminal_width_height.c fclose_nonstdin.c fflush_stdout_and_exit.c \ |
35 | getopt_ulflags.c default_error_retval.c wfopen_input.c speed_table.c \ | 35 | getopt_ulflags.c default_error_retval.c wfopen_input.c speed_table.c \ |
36 | perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c bb_askpass.c \ | 36 | perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c bb_askpass.c \ |
diff --git a/libbb/bb_xchdir.c b/libbb/bb_xchdir.c new file mode 100644 index 000000000..65b01534d --- /dev/null +++ b/libbb/bb_xchdir.c | |||
@@ -0,0 +1,17 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * bb_xchdir.c - a chdir() which dies on failure with error message | ||
4 | * | ||
5 | * Copyright (C) 2006 Denis Vlasenko | ||
6 | * | ||
7 | * Licensed under LGPL, see file docs/lesser.txt in this tarball for details. | ||
8 | */ | ||
9 | #include <unistd.h> | ||
10 | #include "libbb.h" | ||
11 | |||
12 | void bb_xchdir(const char *path) | ||
13 | { | ||
14 | if (chdir(path)) | ||
15 | bb_perror_msg_and_die("chdir(%s)", path); | ||
16 | } | ||
17 | |||