]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Cleanup. open_file(). If SMB_VFS_FSTAT() fails report the error.
authorJeremy Allison <jra@samba.org>
Mon, 7 Jun 2021 20:16:31 +0000 (13:16 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 9 Jun 2021 13:14:29 +0000 (13:14 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/open.c

index ec0757e664bca778ab9d3f96429869066584709f..ab89ee78884f9a8f4794268d468b2fe3f34ea4c8 100644 (file)
@@ -1526,12 +1526,17 @@ static NTSTATUS open_file(files_struct *fsp,
 
                        if (need_re_stat) {
                                ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
-                               /* If we have an fd, this stat should succeed. */
+                               /*
+                                * If we have an fd, this stat should succeed.
+                                */
                                if (ret == -1) {
-                                       DEBUG(0,("Error doing fstat on open file %s "
-                                                "(%s)\n",
+                                       status = map_nt_error_from_unix(errno);
+                                       DBG_ERR("Error doing fstat on open "
+                                               "file %s (%s)\n",
                                                 smb_fname_str_dbg(smb_fname),
-                                                strerror(errno) ));
+                                                nt_errstr(status));
+                                       fd_close(fsp);
+                                       return status;
                                }
                        }