summaryrefslogtreecommitdiff
path: root/source3/smbd/dosmode.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-12-16 16:42:33 -0800
committerJeremy Allison <jra@samba.org>2010-12-17 21:11:04 +0100
commitfe50632d54b7946bf7d7ca776d41aaaf657c895a (patch)
treebdf79e36583c14329d4c47475bcf7a754f543b1d /source3/smbd/dosmode.c
parent192c4a145f22d5d08586476793980c21db7793fe (diff)
downloadsamba-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/dosmode.c')
-rw-r--r--source3/smbd/dosmode.c18
1 files changed, 8 insertions, 10 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.