summaryrefslogtreecommitdiff
path: root/source3/smbd/fileio.c
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-07-08 12:24:03 -0700
committerTim Prouty <tprouty@samba.org>2009-07-08 21:36:03 -0700
commit1a1d10d22f7a2eebd22e76614c3c74b4d49e5c33 (patch)
treedcf066a27e61aa592ef9b9b2e53fc033ce41ab39 /source3/smbd/fileio.c
parent69c8795b672054cb6b5a85cc5f8961099425bd7a (diff)
downloadsamba-1a1d10d22f7a2eebd22e76614c3c74b4d49e5c33.tar.gz
samba-1a1d10d22f7a2eebd22e76614c3c74b4d49e5c33.tar.bz2
samba-1a1d10d22f7a2eebd22e76614c3c74b4d49e5c33.zip
s3: Plumb smb_filename through dos_mode() and related funtions
Diffstat (limited to 'source3/smbd/fileio.c')
-rw-r--r--source3/smbd/fileio.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index caaebf6217..0c13b845df 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -284,32 +284,28 @@ ssize_t write_file(struct smb_request *req,
}
if (!fsp->modified) {
- SMB_STRUCT_STAT st;
+ struct smb_filename *smb_fname = NULL;
+ NTSTATUS status;
+
fsp->modified = True;
- if (SMB_VFS_FSTAT(fsp, &st) == 0) {
+ status = create_synthetic_smb_fname_split(talloc_tos(),
+ fsp->fsp_name, NULL,
+ &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
+ }
+
+ if (SMB_VFS_FSTAT(fsp, &smb_fname->st) == 0) {
int dosmode;
trigger_write_time_update(fsp);
- dosmode = dos_mode(fsp->conn,fsp->fsp_name,&st);
+ dosmode = dos_mode(fsp->conn, smb_fname);
if ((lp_store_dos_attributes(SNUM(fsp->conn)) ||
MAP_ARCHIVE(fsp->conn)) &&
!IS_DOS_ARCHIVE(dosmode)) {
- struct smb_filename *smb_fname = NULL;
- NTSTATUS status;
-
- status = create_synthetic_smb_fname_split(
- talloc_tos(), fsp->fsp_name, &st,
- &smb_fname);
- if (!NT_STATUS_IS_OK(status)) {
- errno =
- map_errno_from_nt_status(status);
- return -1;
- }
-
file_set_dosmode(fsp->conn, smb_fname,
dosmode | aARCH, NULL, false);
- st = smb_fname->st;
- TALLOC_FREE(smb_fname);
}
/*
@@ -318,10 +314,12 @@ ssize_t write_file(struct smb_request *req,
*/
if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) && !wcp) {
- setup_write_cache(fsp, st.st_ex_size);
+ setup_write_cache(fsp,
+ smb_fname->st.st_ex_size);
wcp = fsp->wcp;
}
}
+ TALLOC_FREE(smb_fname);
}
#ifdef WITH_PROFILE