]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r23906: Fix POSIX unlink bug found by Steve. If we
authorJeremy Allison <jra@samba.org>
Tue, 17 Jul 2007 00:09:56 +0000 (00:09 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:28:40 +0000 (12:28 -0500)
used lstat during the open (which we always
do for POSIX) then use lstat for the unlink.
Jeremy.

source/smbd/close.c

index dedf9355011f2c9665086c9625ea7219eb3cb3c3..7c3e1eef2830cb17ff398b2913d058c359bbc619 100644 (file)
@@ -154,6 +154,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
        struct share_mode_lock *lck;
        SMB_STRUCT_STAT sbuf;
        NTSTATUS status = NT_STATUS_OK;
+       int ret;
        struct file_id id;
 
        /*
@@ -247,8 +248,14 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
 
        /* We can only delete the file if the name we have is still valid and
           hasn't been renamed. */
-       
-       if(SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf) != 0) {
+
+       if (fsp->posix_open) {
+               ret = SMB_VFS_LSTAT(conn,fsp->fsp_name,&sbuf);
+       } else {
+               ret = SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf);
+       }
+
+       if (ret != 0) {
                DEBUG(5,("close_remove_share_mode: file %s. Delete on close "
                         "was set and stat failed with error %s\n",
                         fsp->fsp_name, strerror(errno) ));