Moved fchown_acl change to the point where we *really* know if we
authorJeremy Allison <jra@samba.org>
Sun, 16 Dec 2001 23:44:38 +0000 (23:44 +0000)
committerJeremy Allison <jra@samba.org>
Sun, 16 Dec 2001 23:44:38 +0000 (23:44 +0000)
created the file or not.
Jeremy.
(This used to be commit 32dffa0ba792a81d89d06b527d82820b89507efd)

source3/smbd/open.c

index 03540ec7c31282361225ec97cb9b8431d1f65c2f..72f73deb84bb7a22aeee38b047127df1ab6ca8e4 100644 (file)
@@ -204,16 +204,6 @@ static BOOL open_file(files_struct *fsp,connection_struct *conn,
                 BOOLSTR(fsp->can_read), BOOLSTR(fsp->can_write),
                 conn->num_files_open + 1));
 
-       /*
-        * Take care of inherited ACLs on created files. JRA.
-        */
-
-       if ((flags & O_CREAT) && (conn->vfs_ops.fchmod_acl != NULL)) {
-               int saved_errno = errno; /* We might get ENOSYS in the next call.. */
-               if (conn->vfs_ops.fchmod_acl(fsp, fsp->fd, mode) == -1 && errno == ENOSYS)
-                       errno = saved_errno; /* Ignore ENOSYS */
-       }
-               
        return True;
 }
 
@@ -922,6 +912,16 @@ flags=0x%X flags2=0x%X mode=0%o returned %d\n",
                }
        }
        
+       /*
+        * Take care of inherited ACLs on created files. JRA.
+        */
+
+       if (!file_existed && (conn->vfs_ops.fchmod_acl != NULL)) {
+               int saved_errno = errno; /* We might get ENOSYS in the next call.. */
+               if (conn->vfs_ops.fchmod_acl(fsp, fsp->fd, mode) == -1 && errno == ENOSYS)
+                       errno = saved_errno; /* Ignore ENOSYS */
+       }
+               
        unlock_share_entry_fsp(fsp);
 
        conn->num_files_open++;