summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDan Fandrich2010-09-07 23:38:28 -0700
committerDenys Vlasenko2010-09-09 11:48:02 +0200
commit77d48726917e6493a8a077be93bb07b22fd2c209 (patch)
tree71b1d17d7a8a91192d8d0cd3fe0a3dc1028b4a6a /coreutils
parent95d48f259807c408de731f580bd48cf20dec724a (diff)
downloadbusybox-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 'coreutils')
-rw-r--r--coreutils/ls.c3
-rw-r--r--coreutils/tee.c8
2 files changed, 6 insertions, 5 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index cbfcfc7..e69f1af 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -573,7 +573,8 @@ static unsigned print_name(const char *name)
putchar('\\');
len++;
}
- putchar(*name++);
+ putchar(*name);
+ name++;
}
putchar('"');
return len;
diff --git a/coreutils/tee.c b/coreutils/tee.c
index 8db9042..2e1e367 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -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