From: Jeremy Allison Date: Tue, 17 Jul 2007 00:09:56 +0000 (+0000) Subject: r23906: Fix POSIX unlink bug found by Steve. If we X-Git-Tag: samba-misc-tags/initial-v3-2-unstable~701 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4aad77c27cc277e3d937f674ee620729411e3eaf;p=thirdparty%2Fsamba.git r23906: Fix POSIX unlink bug found by Steve. If we used lstat during the open (which we always do for POSIX) then use lstat for the unlink. Jeremy. --- diff --git a/source/smbd/close.c b/source/smbd/close.c index dedf9355011..7c3e1eef283 100644 --- a/source/smbd/close.c +++ b/source/smbd/close.c @@ -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) ));