mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.0.0954: /proc/self/exe might be a relative path
Problem: /proc/self/exe might be a relative path. Solution: Make the path a full path. (James McCoy, closes #1983)
This commit is contained in:
parent
f5be7cd016
commit
bc906e445c
35
src/main.c
35
src/main.c
@ -3597,36 +3597,35 @@ set_progpath(char_u *argv0)
|
|||||||
{
|
{
|
||||||
char_u *val = argv0;
|
char_u *val = argv0;
|
||||||
|
|
||||||
# ifdef PROC_EXE_LINK
|
# if defined(WIN32)
|
||||||
char buf[MAXPATHL + 1];
|
|
||||||
ssize_t len;
|
|
||||||
|
|
||||||
len = readlink(PROC_EXE_LINK, buf, MAXPATHL);
|
|
||||||
if (len > 0)
|
|
||||||
{
|
|
||||||
buf[len] = NUL;
|
|
||||||
val = (char_u *)buf;
|
|
||||||
}
|
|
||||||
# else
|
|
||||||
/* A relative path containing a "/" will become invalid when using ":cd",
|
/* A relative path containing a "/" will become invalid when using ":cd",
|
||||||
* turn it into a full path.
|
* turn it into a full path.
|
||||||
* On MS-Windows "vim" should be expanded to "vim.exe", thus always do
|
* On MS-Windows "vim" should be expanded to "vim.exe", thus always do
|
||||||
* this. */
|
* this. */
|
||||||
# ifdef WIN32
|
|
||||||
char_u *path = NULL;
|
char_u *path = NULL;
|
||||||
|
|
||||||
if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
|
if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
|
||||||
val = path;
|
val = path;
|
||||||
# else
|
# else
|
||||||
char_u buf[MAXPATHL];
|
char_u buf[MAXPATHL + 1];
|
||||||
|
# ifdef PROC_EXE_LINK
|
||||||
|
char linkbuf[MAXPATHL + 1];
|
||||||
|
ssize_t len;
|
||||||
|
|
||||||
if (!mch_isFullName(argv0))
|
len = readlink(PROC_EXE_LINK, linkbuf, MAXPATHL);
|
||||||
|
if (len > 0)
|
||||||
{
|
{
|
||||||
if (gettail(argv0) != argv0
|
linkbuf[len] = NUL;
|
||||||
&& vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
|
val = (char_u *)linkbuf;
|
||||||
val = buf;
|
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
if (!mch_isFullName(val))
|
||||||
|
{
|
||||||
|
if (gettail(val) != val
|
||||||
|
&& vim_FullName(val, buf, MAXPATHL, TRUE) != FAIL)
|
||||||
|
val = buf;
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
set_vim_var_string(VV_PROGPATH, val, -1);
|
set_vim_var_string(VV_PROGPATH, val, -1);
|
||||||
|
@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
954,
|
||||||
/**/
|
/**/
|
||||||
953,
|
953,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user