diff options
author | Rob Landley <rob@landley.net> | 2013-12-19 21:38:12 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2013-12-19 21:38:12 -0600 |
commit | 6db8529a785e2cab142e840b6e3fbdcc2c02dd1f (patch) | |
tree | e22a0b2025f7848f05bcd4f5ed22b57956ef84ea /toys/other/pwdx.c | |
parent | bb5cfb270f924390c2163573cc5ed8fba9f638b8 (diff) | |
download | toybox-6db8529a785e2cab142e840b6e3fbdcc2c02dd1f.tar.gz |
Don't permute toys.optargs, cleanup code (xexec()) can free it.
Diffstat (limited to 'toys/other/pwdx.c')
-rw-r--r-- | toys/other/pwdx.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/toys/other/pwdx.c b/toys/other/pwdx.c index 5be49d62..b2acc411 100644 --- a/toys/other/pwdx.c +++ b/toys/other/pwdx.c @@ -17,11 +17,13 @@ config PWDX void pwdx_main(void) { - for (; *toys.optargs; toys.optargs++) { + char **optargs; + + for (optargs = toys.optargs; *optargs; optargs++) { char *path; int num_bytes; - path = xmsprintf("/proc/%s/cwd", *toys.optargs); + path = xmsprintf("/proc/%s/cwd", *optargs); num_bytes = readlink(path, toybuf, sizeof(toybuf)-1); free(path); @@ -32,6 +34,6 @@ void pwdx_main(void) path = toybuf; toybuf[num_bytes] = 0; } - xprintf("%s: %s\n", *toys.optargs, path); + xprintf("%s: %s\n", *optargs, path); } } |