summaryrefslogtreecommitdiff
path: root/source3/smbd/files.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-05-22 20:31:37 +0000
committerJeremy Allison <jra@samba.org>2003-05-22 20:31:37 +0000
commit67931d602656e7aa86580946d5770c1eb29f890a (patch)
tree462e9b3a08a28760dc8b43f8d2cf68018a050525 /source3/smbd/files.c
parentde55b9ddb08fb9680a499f5904c9c0909161abc5 (diff)
downloadsamba-67931d602656e7aa86580946d5770c1eb29f890a.tar.gz
samba-67931d602656e7aa86580946d5770c1eb29f890a.tar.bz2
samba-67931d602656e7aa86580946d5770c1eb29f890a.zip
Stat opens can have fsp->fd == -1 and will have a share entry. Ensure
that file_find_dif will find them. Fixes a core dump in smbd/open.c. Jeremy. (This used to be commit 0811acb9579007032b54daa90b2666ef07c24624)
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index d926718c5d..b9b27ad5ff 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -231,13 +231,21 @@ files_struct *file_find_dif(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_i
files_struct *fsp;
for (fsp=Files;fsp;fsp=fsp->next,count++) {
- if (fsp->fd != -1 &&
- fsp->dev == dev &&
+ /* We can have a fsp->fd == -1 here as it could be a stat open. */
+ if (fsp->dev == dev &&
fsp->inode == inode &&
fsp->file_id == file_id ) {
if (count > 10) {
DLIST_PROMOTE(Files, fsp);
}
+ /* Paranoia check. */
+ if (fsp->fd == -1 && fsp->oplock_type != NO_OPLOCK) {
+ DEBUG(0,("file_find_dif: file %s dev = %x, inode = %.0f, file_id = %u \
+oplock_type = %u is a stat open with oplock type !\n", fsp->fsp_name, (unsigned int)fsp->dev,
+ (double)fsp->inode, (unsigned int)fsp->file_id,
+ (unsigned int)fsp->oplock_type ));
+ smb_panic("file_find_dif\n");
+ }
return fsp;
}
}