summaryrefslogtreecommitdiff
path: root/source4/libcli/clifile.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-04-06 11:06:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:00:21 -0500
commit8be91f2d0fa38e0dbc19ce8a6bcb382a989459ab (patch)
tree008fd07383b01d68743d061044cab0d691012b8d /source4/libcli/clifile.c
parentfa91368fb4ea2c31f6e1b1037f1bd16ef9f3ba98 (diff)
downloadsamba-8be91f2d0fa38e0dbc19ce8a6bcb382a989459ab.tar.gz
samba-8be91f2d0fa38e0dbc19ce8a6bcb382a989459ab.tar.bz2
samba-8be91f2d0fa38e0dbc19ce8a6bcb382a989459ab.zip
r14946: added a smbcli_ftruncate() call, useful for torture testing
(This used to be commit b8b9acc60003c86fb1f0377b46f65155c3b898a9)
Diffstat (limited to 'source4/libcli/clifile.c')
-rw-r--r--source4/libcli/clifile.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c
index 3acd215f3e..ce49cdea70 100644
--- a/source4/libcli/clifile.c
+++ b/source4/libcli/clifile.c
@@ -576,16 +576,13 @@ NTSTATUS smbcli_setatr(struct smbcli_tree *tree, const char *fname, uint16_t mod
time_t t)
{
union smb_setfileinfo parms;
- NTSTATUS status;
parms.setattr.level = RAW_SFILEINFO_SETATTR;
parms.setattr.in.file.path = fname;
parms.setattr.in.attrib = mode;
parms.setattr.in.write_time = t;
- status = smb_raw_setpathinfo(tree, &parms);
-
- return status;
+ return smb_raw_setpathinfo(tree, &parms);
}
/****************************************************************************
@@ -596,7 +593,6 @@ NTSTATUS smbcli_fsetatr(struct smbcli_tree *tree, int fnum, uint16_t mode,
NTTIME write_time, NTTIME change_time)
{
union smb_setfileinfo parms;
- NTSTATUS status;
parms.basic_info.level = RAW_SFILEINFO_BASIC_INFO;
parms.basic_info.in.file.fnum = fnum;
@@ -606,9 +602,22 @@ NTSTATUS smbcli_fsetatr(struct smbcli_tree *tree, int fnum, uint16_t mode,
parms.basic_info.in.write_time = write_time;
parms.basic_info.in.change_time = change_time;
- status = smb_raw_setfileinfo(tree, &parms);
+ return smb_raw_setfileinfo(tree, &parms);
+}
- return status;
+
+/****************************************************************************
+ truncate a file to a given size
+****************************************************************************/
+NTSTATUS smbcli_ftruncate(struct smbcli_tree *tree, int fnum, uint64_t size)
+{
+ union smb_setfileinfo parms;
+
+ parms.end_of_file_info.level = RAW_SFILEINFO_END_OF_FILE_INFO;
+ parms.end_of_file_info.in.file.fnum = fnum;
+ parms.end_of_file_info.in.size = size;
+
+ return smb_raw_setfileinfo(tree, &parms);
}