1
0
forked from aniani/vim

patch 7.4.1114

Problem:    delete() does not work well with symbolic links.
Solution:   Recognize symbolik links.
This commit is contained in:
Bram Moolenaar
2016-01-17 15:56:34 +01:00
parent 4119cf80e1
commit 43a34f9f74
7 changed files with 105 additions and 6 deletions

View File

@@ -2994,7 +2994,7 @@ mch_hide(name)
}
/*
* return TRUE if "name" is a directory
* return TRUE if "name" is a directory or a symlink to a directory
* return FALSE if "name" is not a directory
* return FALSE for error
*/
@@ -3015,6 +3015,28 @@ mch_isdir(name)
#endif
}
/*
* return TRUE if "name" is a directory, NOT a symlink to a directory
* return FALSE if "name" is not a directory
* return FALSE for error
*/
int
mch_isrealdir(name)
char_u *name;
{
struct stat statb;
if (*name == NUL) /* Some stat()s don't flag "" as an error. */
return FALSE;
if (lstat((char *)name, &statb))
return FALSE;
#ifdef _POSIX_SOURCE
return (S_ISDIR(statb.st_mode) ? TRUE : FALSE);
#else
return ((statb.st_mode & S_IFMT) == S_IFDIR ? TRUE : FALSE);
#endif
}
static int executable_file __ARGS((char_u *name));
/*