summaryrefslogtreecommitdiff
path: root/source3/smbd/close.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-07-17 00:09:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:28:40 -0500
commitb3d471d36740cc6afdf69cb1da438049fa1529a9 (patch)
tree9bde7f486bc08363577e266b78e81684e020bf85 /source3/smbd/close.c
parentf798837c23415653fc83cddeab3285b6f1563526 (diff)
downloadsamba-b3d471d36740cc6afdf69cb1da438049fa1529a9.tar.gz
samba-b3d471d36740cc6afdf69cb1da438049fa1529a9.tar.bz2
samba-b3d471d36740cc6afdf69cb1da438049fa1529a9.zip
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. (This used to be commit 4aad77c27cc277e3d937f674ee620729411e3eaf)
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r--source3/smbd/close.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index dedf935501..7c3e1eef28 100644
--- a/source3/smbd/close.c
+++ b/source3/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) ));