From: Jeremy Allison Date: Mon, 7 Jun 2021 20:16:31 +0000 (-0700) Subject: s3: smbd: Cleanup. open_file(). If SMB_VFS_FSTAT() fails report the error. X-Git-Tag: tevent-0.11.0~643 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68124e2a46fe1766c8265a644c3f1994c2f125e7;p=thirdparty%2Fsamba.git s3: smbd: Cleanup. open_file(). If SMB_VFS_FSTAT() fails report the error. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index ec0757e664b..ab89ee78884 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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; } }