aboutsummaryrefslogtreecommitdiff
path: root/src/memfile.c
diff options
context:
space:
mode:
authorStefan Hoffmann <stefan991@gmail.com>2014-05-02 20:08:36 +0200
committerStefan Hoffmann <stefan991@gmail.com>2014-05-09 15:49:33 +0200
commit8e8dae71da51f068243ecda05bc250d59918f15b (patch)
tree18c3c1052dcb1cfc32d32ef232e76b30db9b2369 /src/memfile.c
parent902ad8d94d9a1eafde858793587037e620c6ee6f (diff)
downloadrneovim-8e8dae71da51f068243ecda05bc250d59918f15b.tar.gz
rneovim-8e8dae71da51f068243ecda05bc250d59918f15b.tar.bz2
rneovim-8e8dae71da51f068243ecda05bc250d59918f15b.zip
replaced some mch_lstat()
Diffstat (limited to 'src/memfile.c')
-rw-r--r--src/memfile.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/memfile.c b/src/memfile.c
index 87ac56b955..9431101d8d 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -1041,10 +1041,6 @@ mf_do_open (
int flags /* flags for open() */
)
{
-#ifdef HAVE_LSTAT
- struct stat sb;
-#endif
-
mfp->mf_fname = fname;
/*
@@ -1054,17 +1050,16 @@ mf_do_open (
*/
mf_set_ffname(mfp);
-#ifdef HAVE_LSTAT
/*
* Extra security check: When creating a swap file it really shouldn't
* exist yet. If there is a symbolic link, this is most likely an attack.
*/
- if ((flags & O_CREAT) && mch_lstat((char *)mfp->mf_fname, &sb) >= 0) {
+ FileInfo file_info;
+ if ((flags & O_CREAT)
+ && os_get_file_info_link((char *)mfp->mf_fname, &file_info)) {
mfp->mf_fd = -1;
EMSG(_("E300: Swap file already exists (symlink attack?)"));
- } else
-#endif
- {
+ } else {
/*
* try to open the file
*/