about summary refs log tree commit diff
path: root/test-instr.c
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2019-11-11 14:36:06 +0100
committerGitHub <noreply@github.com>2019-11-11 14:36:06 +0100
commit659db7e421b47da4b04110a141d9c20307f74ecc (patch)
tree18f9c38cc5270adcf445a62b974712cead4a01c4 /test-instr.c
parentcd84339bccc104a51a5da614a9f82cc4ae615cce (diff)
parent01d55372441960c435af8f3bd6b61d1302042728 (diff)
downloadafl++-659db7e421b47da4b04110a141d9c20307f74ecc.tar.gz
Merge branch 'master' into radamsa
Diffstat (limited to 'test-instr.c')
-rw-r--r--test-instr.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/test-instr.c b/test-instr.c
index 71838462..161bdb8e 100644
--- a/test-instr.c
+++ b/test-instr.c
@@ -2,7 +2,7 @@
    american fuzzy lop - a trivial program to test the build
    --------------------------------------------------------
 
-   Written and maintained by Michal Zalewski <lcamtuf@google.com>
+   Written by Michal Zalewski
 
    Copyright 2014 Google Inc. All rights reserved.
 
@@ -23,15 +23,20 @@ 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 +44,7 @@ int main(int argc, char** argv) {
   else
     printf("Neither one or zero? How quaint!\n");
 
-  exit(0);
+  return 0;
 
 }