diff options
author | van Hauser <vh@thc.org> | 2019-10-17 09:30:50 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2019-10-17 09:30:50 +0200 |
commit | c75abda5711d19340688be1dc8a9af7cd4ea0b7a (patch) | |
tree | 24372fad4d389b221de0bdc0f0382c0f8cc79bfe /test-instr.c | |
parent | 1aec670c43f76c3cf5600a48f12e88c1fc79e07d (diff) | |
download | afl++-c75abda5711d19340688be1dc8a9af7cd4ea0b7a.tar.gz |
return instead of exit in test-instr
Diffstat (limited to 'test-instr.c')
-rw-r--r-- | test-instr.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test-instr.c b/test-instr.c index 71838462..3750b1b5 100644 --- a/test-instr.c +++ b/test-instr.c @@ -23,15 +23,19 @@ int main(int argc, char** argv) { char buff[8]; char* buf = buff; - if (argc > 1) + // we support command line parameter and stdin + if (argc > 1) { + buf = argv[1]; - else if (read(0, buf, sizeof(buf)) < 1) { + + } else if (read(0, buf, sizeof(buf)) < 1) { printf("Hum?\n"); - exit(1); + return 1; } + // we support three input cases (plus a 4th if stdin is used but there is no input) if (buf[0] == '0') printf("Looks like a zero to me!\n"); else if (buf[0] == '1') @@ -39,7 +43,6 @@ int main(int argc, char** argv) { else printf("Neither one or zero? How quaint!\n"); - exit(0); + return 0; } - |