Makes sure we keep the pathref fd open for the NT_FILE_IS_A_DIRECTORY case.
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
bool truncating = (flags & O_TRUNC);
bool open_fd = false;
+ /*
+ * Catch early an attempt to open an existing
+ * directory as a file.
+ */
+ if (file_existed && S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
+ return NT_STATUS_FILE_IS_A_DIRECTORY;
+ }
+
/* Check permissions */
/*