diff options
author | Dan Fandrich | 2010-09-07 23:38:28 -0700 |
---|---|---|
committer | Denys Vlasenko | 2010-09-09 11:48:02 +0200 |
commit | 77d48726917e6493a8a077be93bb07b22fd2c209 (patch) | |
tree | 71b1d17d7a8a91192d8d0cd3fe0a3dc1028b4a6a /shell | |
parent | 95d48f259807c408de731f580bd48cf20dec724a (diff) | |
download | busybox-77d48726917e6493a8a077be93bb07b22fd2c209.zip busybox-77d48726917e6493a8a077be93bb07b22fd2c209.tar.gz |
Avoid side effects in putc(), which may be implemented as a macro
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index 70425b3..f262872 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -953,7 +953,8 @@ sharg(union node *arg, FILE *fp) for (p = arg->narg.text; *p; p++) { switch ((unsigned char)*p) { case CTLESC: - putc(*++p, fp); + p++; + putc(*p, fp); break; case CTLVAR: putc('$', fp); @@ -962,8 +963,10 @@ sharg(union node *arg, FILE *fp) if (subtype == VSLENGTH) putc('#', fp); - while (*p != '=') - putc(*p++, fp); + while (*p != '=') { + putc(*p, fp); + p++; + } if (subtype & VSNUL) putc(':', fp); |