From 6db8529a785e2cab142e840b6e3fbdcc2c02dd1f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 19 Dec 2013 21:38:12 -0600 Subject: Don't permute toys.optargs, cleanup code (xexec()) can free it. --- toys/other/pwdx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'toys/other/pwdx.c') 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); } } -- cgit v1.2.3