summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2020-07-15 12:04:10 +0200
committerJeremy Allison <jra@samba.org>2020-07-18 05:58:41 +0000
commit8c2c749157aac80317e9de34cf99e779c0af87fe (patch)
treeb85f4760b556590d4801cc671c02cd1e9207043e /source3/smbd
parent92d8b5f5ed3910546183b5663e31d6b6c44ad6cc (diff)
downloadsamba-8c2c749157aac80317e9de34cf99e779c0af87fe.tar.gz
smbd: use helper variable for fd in fd_open()
No change in behaviour. Fwiw, no need to set fsp->fh->fd to -1 in the error case, as that is initialized to -1 in fsp_new(). Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/open.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 545c19b4d6c..9430b38b0ea 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -779,6 +779,7 @@ NTSTATUS fd_open(files_struct *fsp,
struct connection_struct *conn = fsp->conn;
struct smb_filename *smb_fname = fsp->fsp_name;
NTSTATUS status = NT_STATUS_OK;
+ int fd;
/*
* Never follow symlinks on a POSIX client. The
@@ -793,12 +794,8 @@ NTSTATUS fd_open(files_struct *fsp,
* Only follow symlinks within a share
* definition.
*/
- fsp->fh->fd = non_widelink_open(fsp,
- smb_fname,
- flags,
- mode,
- 0);
- if (fsp->fh->fd == -1) {
+ fd = non_widelink_open(fsp, smb_fname, flags, mode, 0);
+ if (fd == -1) {
int posix_errno = link_errno_convert(errno);
status = map_nt_error_from_unix(posix_errno);
if (errno == EMFILE) {
@@ -815,12 +812,14 @@ NTSTATUS fd_open(files_struct *fsp,
DBG_DEBUG("name %s, flags = 0%o mode = 0%o, fd = %d. %s\n",
smb_fname_str_dbg(smb_fname), flags, (int)mode,
- fsp->fh->fd, strerror(errno));
+ fd, strerror(errno));
return status;
}
+ fsp->fh->fd = fd;
+
DBG_DEBUG("name %s, flags = 0%o mode = 0%o, fd = %d\n",
- smb_fname_str_dbg(smb_fname), flags, (int)mode, fsp->fh->fd);
+ smb_fname_str_dbg(smb_fname), flags, (int)mode, fd);
return status;
}