summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_open.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-07 10:05:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:37 -0500
commit2db915e06564b42bf7ebfa526b1af2e42e591590 (patch)
treea6cb2c29dcdc0278f8afd5b2ed9bdff9dce73d00 /source4/ntvfs/posix/pvfs_open.c
parent5f608f23d32003456ebeed0ef6afdfd3f40aea25 (diff)
downloadsamba-2db915e06564b42bf7ebfa526b1af2e42e591590.tar.gz
samba-2db915e06564b42bf7ebfa526b1af2e42e591590.tar.bz2
samba-2db915e06564b42bf7ebfa526b1af2e42e591590.zip
r3595: - fixed a talloc_free ordering problem on cleanup with pending requests
- added initial support for MODE_INFORMATION in setfileinfo (I have no idea what "mode information" on a file is - it takes a value of 0, 2, 4 or 6. What could it be?) (This used to be commit e53ec2f6b68e1d19149c36ea8fcd25a204db38fb)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_open.c')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index f30d53d51a..1a25f57df1 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -142,6 +142,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
f->share_access = io->generic.in.share_access;
f->seek_offset = 0;
f->position = 0;
+ f->mode = 0;
DLIST_ADD(pvfs->open_files, f);
@@ -362,6 +363,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
}
status = odb_open_file(lck, fnum, share_access, create_options, access_mask);
+ talloc_free(lck);
if (!NT_STATUS_IS_OK(status)) {
/* bad news, we must have hit a race */
idr_remove(pvfs->idtree_fnum, fnum);
@@ -382,6 +384,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
f->access_mask = access_mask;
f->seek_offset = 0;
f->position = 0;
+ f->mode = 0;
f->have_opendb_entry = True;
DLIST_ADD(pvfs->open_files, f);
@@ -433,6 +436,7 @@ static int pvfs_retry_destructor(void *ptr)
if (lck != NULL) {
odb_remove_pending(lck, r);
}
+ talloc_free(lck);
}
return 0;
}
@@ -768,6 +772,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
}
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(lck);
return status;
}
@@ -776,6 +781,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
/* do the actual open */
fd = open(f->name->full_name, flags);
if (fd == -1) {
+ talloc_free(lck);
return pvfs_map_errno(f->pvfs, errno);
}
@@ -784,6 +790,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
/* re-resolve the open fd */
status = pvfs_resolve_name_fd(f->pvfs, fd, f->name);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(lck);
return status;
}
@@ -793,15 +800,18 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
uint32_t attrib = io->ntcreatex.in.file_attr | FILE_ATTRIBUTE_ARCHIVE;
mode_t mode = pvfs_fileperms(pvfs, attrib);
if (fchmod(fd, mode) == -1) {
+ talloc_free(lck);
return map_nt_error_from_unix(errno);
}
name->dos.attrib = attrib;
status = pvfs_dosattrib_save(pvfs, name, fd);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(lck);
return status;
}
}
+ talloc_free(lck);
io->generic.out.oplock_level = NO_OPLOCK;
io->generic.out.fnum = f->fnum;