diff --git a/src/kuroko.c b/src/kuroko.c index b3bd609..9f28319 100644 --- a/src/kuroko.c +++ b/src/kuroko.c @@ -287,7 +287,7 @@ static void findInterpreter(char * argv[]) { #else /* Try asking /proc */ char * binpath = realpath("/proc/self/exe", NULL); - if (!binpath) { + if (!binpath || (access(binpath, X_OK) != 0)) { if (strchr(argv[0], '/')) { binpath = realpath(argv[0], NULL); } else { @@ -300,7 +300,7 @@ static void findInterpreter(char * argv[]) { char tmp[4096]; sprintf(tmp, "%s/%s", path, argv[0]); - if (access(tmp, X_OK)) { + if (access(tmp, X_OK) == 0) { binpath = strdup(tmp); break; } diff --git a/src/scanner.c b/src/scanner.c index 0832ba3..6f0cdc1 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "kuroko.h" #include "scanner.h"