summaryrefslogtreecommitdiffstats
path: root/byterun/startup.c
diff options
context:
space:
mode:
Diffstat (limited to 'byterun/startup.c')
-rw-r--r--byterun/startup.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/byterun/startup.c b/byterun/startup.c
index 942791d4d..dd1229560 100644
--- a/byterun/startup.c
+++ b/byterun/startup.c
@@ -322,7 +322,6 @@ CAMLexport void caml_main(char **argv)
char * exe_name;
#ifdef __linux__
static char proc_self_exe[256];
- int retcode;
#endif
/* Machine-dependent initialization of the floating-point hardware
@@ -339,12 +338,8 @@ CAMLexport void caml_main(char **argv)
pos = 0;
exe_name = argv[0];
#ifdef __linux__
- /* Recover executable name from /proc/self/exe, much more reliable */
- retcode = readlink("/proc/self/exe", proc_self_exe, sizeof(proc_self_exe));
- if (retcode != -1 && retcode < sizeof(proc_self_exe)) {
- proc_self_exe[retcode] = 0;
+ if (executable_name(proc_self_exe, sizeof(proc_self_exe)) == 0)
exe_name = proc_self_exe;
- }
#endif
fd = attempt_open(&exe_name, &trail, 0);
if (fd < 0) {