[hackers] [sbase] Fix potential modulo 0 || FRIGN
commit 0b5ab80b05d396bb51ef4d7ddda222715c63a7b1
Author: FRIGN <dev_AT_frign.de>
Date: Sun Feb 1 02:23:35 2015 +0100
Fix potential modulo 0
diff --git a/yes.c b/yes.c
index fe9af7f..c3f2314 100644
--- a/yes.c
+++ b/yes.c
_AT_@ -20,8 +20,11 @@ main(int argc, char *argv[])
usage();
} ARGEND;
- for (i = 0; ;i++, i %= argc) {
- printf("%s", (argc > 0) ? argv[i] : "y");
+ if (argc == 0)
+ for (;;)
+ puts("y");
+ for (i = 0; ; i++, i %= argc) {
+ printf("%s", argv[i]);
putchar((i == argc - 1) ? '\n' : ' ');
}
return 1; /* should not reach */
Received on Tue Mar 24 2015 - 23:53:33 CET
This archive was generated by hypermail 2.3.0
: Wed Mar 25 2015 - 00:07:39 CET