about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNikolay Shaplov <dhyan@nataraj.su>2023-02-03 14:32:17 +0000
committerNikolay Shaplov <dhyan@nataraj.su>2023-02-03 14:32:17 +0000
commitdf9ef84f5e042bdc1db764e83baa83cb30a80d31 (patch)
treed1ea0f5694dd22c42360a809e1460adeef2ee7fa
parentf01bf77604c7d5b2ee12a44cbb3dbd615ad9565e (diff)
downloadafl++-df9ef84f5e042bdc1db764e83baa83cb30a80d31.tar.gz
Explicitly print error code if sched_setaffinity fails
-rw-r--r--src/afl-gotcpu.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c
index c5b8a27a..1762cfe2 100644
--- a/src/afl-gotcpu.c
+++ b/src/afl-gotcpu.c
@@ -214,7 +214,13 @@ int main(int argc, char **argv) {
   #if defined(__linux__)
       if (sched_setaffinity(0, sizeof(c), &c)) {
 
-        PFATAL("sched_setaffinity failed for cpu %d", i);
+        const char *error_code = "Unkown error code";
+        if (errno == EFAULT) error_code = "EFAULT";
+        if (errno == EINVAL) error_code = "EINVAL";
+        if (errno == EPERM)  error_code = "EPERM";
+        if (errno == ESRCH)  error_code = "ESRCH";
+
+        PFATAL("sched_setaffinity failed for cpu %d, error: %s", i, error_code);
 
       }