summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-11 21:53:29 +0100
committerVolker Lendecke <vl@samba.org>2008-01-12 20:11:10 +0100
commit4c0ca860515a799ddcda3804fe4c2080d1df9b80 (patch)
tree39ed0c6a55e4e96405c30ac6d4e583a22cada5b1
parent360673e80e8d46167afb6c393773895b369ff290 (diff)
downloadsamba-4c0ca860515a799ddcda3804fe4c2080d1df9b80.tar.gz
samba-4c0ca860515a799ddcda3804fe4c2080d1df9b80.tar.bz2
samba-4c0ca860515a799ddcda3804fe4c2080d1df9b80.zip
There's no point in calling FLOCK on a non-existing fd
(This used to be commit 9ff79f231f1206631662b5c521ecddf5df9141c0)
-rw-r--r--source3/smbd/open.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 59699dfbd0..d1679209bb 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1761,14 +1761,16 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
the kernel refuses the operations then the kernel is wrong.
note that GPFS supports it as well - jmcd */
- ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access);
- if(ret_flock == -1 ){
+ if (fsp->fh->fd != -1) {
+ ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access);
+ if(ret_flock == -1 ){
- TALLOC_FREE(lck);
- fd_close(fsp);
- file_free(fsp);
-
- return NT_STATUS_SHARING_VIOLATION;
+ TALLOC_FREE(lck);
+ fd_close(fsp);
+ file_free(fsp);
+
+ return NT_STATUS_SHARING_VIOLATION;
+ }
}
/*