Fix up binpath discovery which was totally broken
This commit is contained in:
parent
dce6c4b79e
commit
f9cfa4e622
@ -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;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "kuroko.h"
|
||||
#include "scanner.h"
|
||||
|
Loading…
Reference in New Issue
Block a user