aboutsummaryrefslogtreecommitdiff
path: root/toys/other/pmap.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-12-19 21:38:12 -0600
committerRob Landley <rob@landley.net>2013-12-19 21:38:12 -0600
commit6db8529a785e2cab142e840b6e3fbdcc2c02dd1f (patch)
treee22a0b2025f7848f05bcd4f5ed22b57956ef84ea /toys/other/pmap.c
parentbb5cfb270f924390c2163573cc5ed8fba9f638b8 (diff)
downloadtoybox-6db8529a785e2cab142e840b6e3fbdcc2c02dd1f.tar.gz
Don't permute toys.optargs, cleanup code (xexec()) can free it.
Diffstat (limited to 'toys/other/pmap.c')
-rw-r--r--toys/other/pmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/toys/other/pmap.c b/toys/other/pmap.c
index 1cc04220..9ef1ade9 100644
--- a/toys/other/pmap.c
+++ b/toys/other/pmap.c
@@ -24,8 +24,10 @@ config PMAP
void pmap_main(void)
{
- while (*toys.optargs) {
- pid_t pid = atolx(*toys.optargs++);
+ char **optargs;
+
+ for (optargs = toys.optargs; *optargs; optargs++) {
+ pid_t pid = atolx(*optargs);
FILE *fp;
char *line, *oldline = 0, *name = 0,
*k = (toys.optflags & FLAG_x) ? "" : "K";