about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-11-03 13:41:06 +0100
committerDominik Maier <domenukk@gmail.com>2020-11-03 13:41:06 +0100
commitd795ec0451bfb6f93485c4ec6436ae1af3840070 (patch)
treef3d929755b98483be06114f40df6c69c6746197b /src
parent350c3b323a59c99891635a233c3f82f83653947c (diff)
downloadafl++-d795ec0451bfb6f93485c4ec6436ae1af3840070.tar.gz
added better error handling to forkserver fd
Diffstat (limited to 'src')
-rw-r--r--src/afl-forkserver.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index d23cf6eb..714be24e 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -983,10 +983,13 @@ void afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
 
       if (fd < 0) { PFATAL("Unable to create '%s'", fsrv->out_file); }
 
-    } else if (unlikely(!fd)) {
+    } else if (unlikely(fd <= 0)) {
 
-      // We should never have stdin as fd here, 0 is likely unset.
-      FATAL("Nowhere to write output to (neither out_fd nor out_file set)");
+      // We should have a (non-stdin) fd at this point, else we got a problem.
+      FATAL(
+          "Nowhere to write output to (neither out_fd nor out_file set (fd is "
+          "%d))",
+          fd);
 
     } else {