Skip to content

Commit f3757f0

Browse files
committed
patch 8.0.0464: can't find executable name on Solaris and FreeBSD
Problem: Can't find executable name on Solaris and FreeBSD. Solution: Check for "/proc/self/path/a.out". (Danek Duvall) And for "/proc/curproc/file".
1 parent 0f39a82 commit f3757f0

File tree

5 files changed

+35
-14
lines changed

5 files changed

+35
-14
lines changed

src/auto/configure

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10101,15 +10101,25 @@ fi
1010110101

1010210102

1010310103

10104-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/self/exe" >&5
10105-
$as_echo_n "checking for /proc/self/exe... " >&6; }
10104+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc link to executable" >&5
10105+
$as_echo_n "checking for /proc link to executable... " >&6; }
1010610106
if test -L "/proc/self/exe"; then
10107-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
10108-
$as_echo "yes" >&6; }
10109-
$as_echo "#define HAVE_PROC_SELF_EXE 1" >>confdefs.h
10107+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: /proc/self/exe" >&5
10108+
$as_echo "/proc/self/exe" >&6; }
10109+
$as_echo "#define PROC_EXE_LINK \"/proc/self/exe\"" >>confdefs.h
10110+
10111+
elif test -L "/proc/self/path/a.out"; then
10112+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: /proc/self/path/a.out" >&5
10113+
$as_echo "/proc/self/path/a.out" >&6; }
10114+
$as_echo "#define PROC_EXE_LINK \"/proc/self/path/a.out\"" >>confdefs.h
10115+
10116+
elif test -L "/proc/curproc/file"; then
10117+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: /proc/curproc/file" >&5
10118+
$as_echo "/proc/curproc/file" >&6; }
10119+
$as_echo "#define PROC_EXE_LINK \"/proc/curproc/file\"" >>confdefs.h
1011010120

1011110121
else
10112-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
10122+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1011310123
$as_echo "no" >&6; }
1011410124
fi
1011510125

src/config.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@
446446
/* Define if fcntl()'s F_SETFD command knows about FD_CLOEXEC */
447447
#undef HAVE_FD_CLOEXEC
448448

449-
/* Define if /proc/self/exe can be read */
450-
#undef HAVE_PROC_SELF_EXE
449+
/* Define if /proc/self/exe or similar can be read */
450+
#undef PROC_EXE_LINK
451451

452452
/* Define if you want Cygwin to use the WIN32 clipboard, not compatible with X11*/
453453
#undef FEAT_CYGWIN_WIN32_CLIPBOARD

src/configure.ac

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,12 +3020,21 @@ dnl ---------------------------------------------------------------------------
30203020
dnl end of GUI-checking
30213021
dnl ---------------------------------------------------------------------------
30223022

3023-
AC_MSG_CHECKING([for /proc/self/exe])
3023+
AC_MSG_CHECKING([for /proc link to executable])
30243024
if test -L "/proc/self/exe"; then
3025-
AC_MSG_RESULT(yes)
3026-
AC_DEFINE(HAVE_PROC_SELF_EXE)
3025+
dnl Linux
3026+
AC_MSG_RESULT([/proc/self/exe])
3027+
AC_DEFINE(PROC_EXE_LINK, "/proc/self/exe")
3028+
elif test -L "/proc/self/path/a.out"; then
3029+
dnl Solaris
3030+
AC_MSG_RESULT([/proc/self/path/a.out])
3031+
AC_DEFINE(PROC_EXE_LINK, "/proc/self/path/a.out")
3032+
elif test -L "/proc/curproc/file"; then
3033+
dnl FreeBSD
3034+
AC_MSG_RESULT([/proc/curproc/file])
3035+
AC_DEFINE(PROC_EXE_LINK, "/proc/curproc/file")
30273036
else
3028-
AC_MSG_RESULT(no)
3037+
AC_MSG_RESULT(no)
30293038
fi
30303039

30313040
dnl Check for Cygwin, which needs an extra source file if not using X11

src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3539,11 +3539,11 @@ set_progpath(char_u *argv0)
35393539
{
35403540
char_u *val = argv0;
35413541

3542-
# ifdef HAVE_PROC_SELF_EXE
3542+
# ifdef PROC_EXE_LINK
35433543
char buf[PATH_MAX + 1];
35443544
ssize_t len;
35453545

3546-
len = readlink("/proc/self/exe", buf, PATH_MAX);
3546+
len = readlink(PROC_EXE_LINK, buf, PATH_MAX);
35473547
if (len > 0)
35483548
{
35493549
buf[len] = NUL;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
464,
767769
/**/
768770
463,
769771
/**/

0 commit comments

Comments
 (0)