From 77d48726917e6493a8a077be93bb07b22fd2c209 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Tue, 7 Sep 2010 23:38:28 -0700 Subject: Avoid side effects in putc(), which may be implemented as a macro Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- shell/ash.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 70425b324..f262872ea 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); -- cgit v1.2.3-55-g6feb