diff options
author | hexcoder- <heiko@hexco.de> | 2020-12-05 09:48:55 +0100 |
---|---|---|
committer | hexcoder- <heiko@hexco.de> | 2020-12-05 09:48:55 +0100 |
commit | 8f79116a15e53f0ecd4889ebf8980cc0cd85a494 (patch) | |
tree | 48762cd29e5680a8e25bb66b6324fd6ff6e047a4 | |
parent | f8c33f29e8cf7de30604be2c6818dd8d2d0ad3a6 (diff) | |
download | afl++-8f79116a15e53f0ecd4889ebf8980cc0cd85a494.tar.gz |
fix find_object proc search (#elsif -> #elif), optimize static if away
-rw-r--r-- | src/afl-cc.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c index fcc10122..1cd53f98 100644 --- a/src/afl-cc.c +++ b/src/afl-cc.c @@ -189,14 +189,25 @@ static u8 *find_object(u8 *obj, u8 *argv0) { ck_free(tmp); ck_free(dir); - } else { + } + +#if \ + defined(__FreeBSD__) \ +|| defined(__DragonFly__) \ +|| defined(__linux__) \ +|| defined(__ANDROID__) \ +|| defined(__NetBSD__) +#define HAS_PROC_FS 1 +#endif +#ifdef HAS_PROC_FS + else { char *procname = NULL; #if defined(__FreeBSD__) || defined(__DragonFly__) procname = "/proc/curproc/file"; - #elsif defined(__linux__) || defined(__ANDROID__) + #elif defined(__linux__) || defined(__ANDROID__) procname = "/proc/self/exe"; - #elsif defined(__NetBSD__) + #elif defined(__NetBSD__) procname = "/proc/curproc/exe"; #endif if (procname) { @@ -239,6 +250,8 @@ static u8 *find_object(u8 *obj, u8 *argv0) { } } +#endif +#undef HAS_PROC_FS } |