diff options
author | Ron Yorston <rmy@pobox.com> | 2017-08-22 14:56:12 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-08-22 14:56:12 +0100 |
commit | ce9af1cc5ea23f754587448cf35b5120c77bfeef (patch) | |
tree | 69e5eaba5e75ab909ed92d5045393471b8ff3c13 /procps/pwdx.c | |
parent | c170026700eabb10147dd848c45c06995b43a32e (diff) | |
parent | e837a0dbbebf4229306df98fe9ee3b9bb30630c4 (diff) | |
download | busybox-w32-ce9af1cc5ea23f754587448cf35b5120c77bfeef.tar.gz busybox-w32-ce9af1cc5ea23f754587448cf35b5120c77bfeef.tar.bz2 busybox-w32-ce9af1cc5ea23f754587448cf35b5120c77bfeef.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'procps/pwdx.c')
-rw-r--r-- | procps/pwdx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/procps/pwdx.c b/procps/pwdx.c index dac238950..c72cf804a 100644 --- a/procps/pwdx.c +++ b/procps/pwdx.c | |||
@@ -14,7 +14,7 @@ | |||
14 | //config: help | 14 | //config: help |
15 | //config: Report current working directory of a process | 15 | //config: Report current working directory of a process |
16 | 16 | ||
17 | //applet:IF_PWDX(APPLET(pwdx, BB_DIR_USR_BIN, BB_SUID_DROP)) | 17 | //applet:IF_PWDX(APPLET_NOFORK(pwdx, pwdx, BB_DIR_USR_BIN, BB_SUID_DROP, pwdx)) |
18 | 18 | ||
19 | //kbuild:lib-$(CONFIG_PWDX) += pwdx.o | 19 | //kbuild:lib-$(CONFIG_PWDX) += pwdx.o |
20 | 20 | ||
@@ -28,8 +28,7 @@ | |||
28 | int pwdx_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 28 | int pwdx_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
29 | int pwdx_main(int argc UNUSED_PARAM, char **argv) | 29 | int pwdx_main(int argc UNUSED_PARAM, char **argv) |
30 | { | 30 | { |
31 | opt_complementary = "-1"; | 31 | getopt32(argv, "^" "" "\0" "-1"); |
32 | getopt32(argv, ""); | ||
33 | argv += optind; | 32 | argv += optind; |
34 | 33 | ||
35 | do { | 34 | do { |
@@ -50,6 +49,7 @@ int pwdx_main(int argc UNUSED_PARAM, char **argv) | |||
50 | 49 | ||
51 | sprintf(buf, "/proc/%u/cwd", pid); | 50 | sprintf(buf, "/proc/%u/cwd", pid); |
52 | 51 | ||
52 | /* NOFORK: only one alloc is allowed; must free */ | ||
53 | s = xmalloc_readlink(buf); | 53 | s = xmalloc_readlink(buf); |
54 | // "pwdx /proc/1" says "/proc/1: DIR", not "1: DIR" | 54 | // "pwdx /proc/1" says "/proc/1: DIR", not "1: DIR" |
55 | printf("%s: %s\n", *argv, s ? s : strerror(errno == ENOENT ? ESRCH : errno)); | 55 | printf("%s: %s\n", *argv, s ? s : strerror(errno == ENOENT ? ESRCH : errno)); |