Permalink
Browse files

In caml_executable_name(), wrong test on the return code of readlink()

Follow-up to PR#795 "More robust determination of full path to current executable"
  • Loading branch information...
xavierleroy committed Aug 25, 2017
1 parent b0c3758 commit e49e6ce5ee35fb5e7b6647004b0781532d7e03c3
Showing with 1 addition and 1 deletion.
  1. +1 −1 byterun/unix.c
View
@@ -372,7 +372,7 @@ char * caml_executable_name(void)
name = caml_stat_alloc(namelen + 1);
retcode = readlink("/proc/self/exe", name, namelen);
if (retcode == -1) { caml_stat_free(name); return NULL; }
if (retcode <= namelen) break;
if (retcode < namelen) break;
caml_stat_free(name);
if (namelen >= 1024*1024) return NULL; /* avoid runaway and overflow */
namelen *= 2;

0 comments on commit e49e6ce

Please sign in to comment.