diff options
author | Tim Potter <tpot@samba.org> | 2000-02-17 23:22:26 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2000-02-17 23:22:26 +0000 |
commit | 92bf37e21d63c0c9edede1617c85510a16011e7a (patch) | |
tree | a7acabf3c00a1030f2158f514a989ccaee28cad8 | |
parent | c988b69dfc061a0f4f464f2a11e4d5509e1e61e4 (diff) | |
download | samba-92bf37e21d63c0c9edede1617c85510a16011e7a.tar.gz samba-92bf37e21d63c0c9edede1617c85510a16011e7a.tar.bz2 samba-92bf37e21d63c0c9edede1617c85510a16011e7a.zip |
Don't assume that the (files_struct *) passed to fd_attempt_close()
will be non-NULL.
(This used to be commit 02f845e54351ec57ee873a8ed887285552c6ecab)
-rw-r--r-- | source3/smbd/open.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 30409707d3..6352233dbc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -152,11 +152,18 @@ Decrements the ref_count and returns it. uint16 fd_attempt_close(files_struct *fsp, int *err_ret) { extern struct current_user current_user; - file_fd_struct *fd_ptr = fsp->fd_ptr; - uint16 ret_ref = fd_ptr->ref_count; + file_fd_struct *fd_ptr; + uint16 ret_ref; *err_ret = 0; + if ((fsp == NULL) || (fsp->fd_ptr == NULL)) { + return 0; + } + + fd_ptr = fsp->fd_ptr; + ret_ref = fd_ptr->ref_count; + DEBUG(3,("fd_attempt_close fd = %d, dev = %x, inode = %.0f, open_flags = %d, ref_count = %d.\n", fd_ptr->fd, (unsigned int)fd_ptr->dev, (double)fd_ptr->inode, fd_ptr->real_open_flags, |