summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r--source3/smbd/open.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 3cd553f55b..98c2997a97 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1585,6 +1585,15 @@ files_struct *open_file_ntcreate(connection_struct *conn,
fsp_open = open_file(fsp,conn,fname,psbuf,flags|flags2,unx_mode,access_mask);
+ if (!fsp_open && (flags2 & O_EXCL) && (errno == EEXIST)) {
+ /*
+ * Two smbd's tried to open exclusively, but only one of them
+ * succeeded.
+ */
+ file_free(fsp);
+ return NULL;
+ }
+
if (!fsp_open && (flags == O_RDWR) && (errno != ENOENT)) {
if((fsp_open = open_file(fsp,conn,fname,psbuf,
O_RDONLY,unx_mode,access_mask)) == True) {