diff options
author | Jeremy Allison <jra@samba.org> | 2010-12-16 16:42:33 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-12-17 21:11:04 +0100 |
commit | fe50632d54b7946bf7d7ca776d41aaaf657c895a (patch) | |
tree | bdf79e36583c14329d4c47475bcf7a754f543b1d /source3/smbd | |
parent | 192c4a145f22d5d08586476793980c21db7793fe (diff) | |
download | samba-fe50632d54b7946bf7d7ca776d41aaaf657c895a.tar.gz samba-fe50632d54b7946bf7d7ca776d41aaaf657c895a.tar.bz2 samba-fe50632d54b7946bf7d7ca776d41aaaf657c895a.zip |
file_set_sparse needs to be a handle based call.
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/dosmode.c | 18 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 2 |
2 files changed, 9 insertions, 11 deletions
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 5d6e4b4760..86f7807506 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -848,27 +848,26 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname, NTSTATUS file_set_sparse(connection_struct *conn, - struct smb_filename *smb_fname, + files_struct *fsp, bool sparse) { - SMB_STRUCT_STAT st; uint32_t old_dosmode; uint32_t new_dosmode; + NTSTATUS status; DEBUG(10,("file_set_sparse: setting sparse bit %u on file %s\n", - sparse, smb_fname_str_dbg(smb_fname))); + sparse, smb_fname_str_dbg(fsp->fsp_name))); if (!lp_store_dos_attributes(SNUM(conn))) { return NT_STATUS_INVALID_DEVICE_REQUEST; } - SET_STAT_INVALID(st); - - if (SMB_VFS_STAT(conn, smb_fname)) { - return map_nt_error_from_unix(errno); + status = vfs_stat_fsp(fsp); + if (!NT_STATUS_IS_OK(status)) { + return status; } - old_dosmode = dos_mode(conn, smb_fname); + old_dosmode = dos_mode(conn, fsp->fsp_name); if (sparse && !(old_dosmode & FILE_ATTRIBUTE_SPARSE)) { new_dosmode = old_dosmode | FILE_ATTRIBUTE_SPARSE; @@ -879,7 +878,7 @@ NTSTATUS file_set_sparse(connection_struct *conn, } /* Store the DOS attributes in an EA. */ - if (!set_ea_dos_attribute(conn, smb_fname, + if (!set_ea_dos_attribute(conn, fsp->fsp_name, new_dosmode)) { if (errno == 0) { errno = EIO; @@ -894,7 +893,6 @@ NTSTATUS file_set_sparse(connection_struct *conn, return NT_STATUS_OK; } - /******************************************************************* Wrapper around the VFS ntimes that possibly allows DOS semantics rather than POSIX. diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 8d92d60642..55804b9035 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2140,7 +2140,7 @@ static void call_nt_transact_ioctl(connection_struct *conn, return; } - status = file_set_sparse(conn, fsp->fsp_name, set_sparse); + status = file_set_sparse(conn, fsp, set_sparse); if (!NT_STATUS_IS_OK(status)) { DEBUG(9,("FSCTL_SET_SPARSE: fname[%s] set[%u] - %s\n", smb_fname_str_dbg(fsp->fsp_name), set_sparse, nt_errstr(status))); |