Avoid side effects in putc(), which may be implemented as a macro
No binary (build failed)
—
(log yok)
| @@ -573,7 +573,8 @@ static unsigned print_name(const char *name) | |
| putchar('\\'); | |
| len++; | |
| } | |
| - | putchar(*name++); |
| + | putchar(*name); |
| + | name++; |
| } | |
| putchar('"'); | |
| return len; | |
| @@ -70,8 +70,8 @@ int tee_main(int argc, char **argv) | |
| while ((c = safe_read(STDIN_FILENO, buf, sizeof(buf))) > 0) { | |
| fp = files; | |
| do | |
| - | fwrite(buf, 1, c, *fp++); |
| - | while (*fp); |
| + | fwrite(buf, 1, c, *fp); |
| + | while (*++fp); |
| } | |
| if (c < 0) { /* Make sure read errors are signaled. */ | |
| retval = EXIT_FAILURE; | |
| @@ -81,8 +81,8 @@ int tee_main(int argc, char **argv) | |
| while ((c = getchar()) != EOF) { | |
| fp = files; | |
| do | |
| - | putc(c, *fp++); |
| - | while (*fp); |
| + | putc(c, *fp); |
| + | while (*++fp); |
| } | |
| #endif | |
| @@ -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); | |