about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-02-04 13:55:29 +0100
committerGitHub <noreply@github.com>2023-02-04 13:55:29 +0100
commit3a6dea420fcf05cc2abff4199e35cb86316c961c (patch)
tree1b0efe21e0707c9cb6b9e5b8993a1c6d22fea171
parent25b4b32627a1ef1e65b328f90f3ad1fd25d8f906 (diff)
parentdf9ef84f5e042bdc1db764e83baa83cb30a80d31 (diff)
downloadafl++-3a6dea420fcf05cc2abff4199e35cb86316c961c.tar.gz
Merge pull request #1634 from nataraj-hates-MS-for-stealing-github/stable
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);
 
       }