diff options
Diffstat (limited to 'src/memfile.c')
-rw-r--r-- | src/memfile.c | 13 |
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 */ |