summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-11-20 02:33:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:02 -0500
commitf55ee60575576e2213b234f4690d7a300a8e362e (patch)
treec872bab365056586bea23c7b32e6819bf16be90f /source4/torture
parentc760b8b969f550b0fe3d61f089c133994af2dd60 (diff)
downloadsamba-f55ee60575576e2213b234f4690d7a300a8e362e.tar.gz
samba-f55ee60575576e2213b234f4690d7a300a8e362e.tar.bz2
samba-f55ee60575576e2213b234f4690d7a300a8e362e.zip
r3888: Just proving :-) to tridge that a Setfileinfo with a modified
write time is sticky, and causes any subsequent writes not to update the last write time. Added write that extends the file followed by fnum specific smbflush. It stays the same time :-). Jeremy. (This used to be commit a2ea2166dcb7044d7b9e53417e53febea2f81e20)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/delaywrite.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c
index 0566e26cb9..51fe2814e2 100644
--- a/source4/torture/basic/delaywrite.c
+++ b/source4/torture/basic/delaywrite.c
@@ -124,6 +124,7 @@ static BOOL test_delayed_write_update2(struct smbcli_state *cli, TALLOC_CTX *mem
BOOL ret = True;
ssize_t written;
time_t t;
+ struct smb_flush flsh;
printf("Testing delayed update of write time using 2 connections\n");
@@ -231,13 +232,27 @@ static BOOL test_delayed_write_update2(struct smbcli_state *cli, TALLOC_CTX *mem
nt_time_string(mem_ctx, finfo1.basic_info.out.write_time));
- written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
+ printf("Doing a 10 byte write to extend the file and see if this changes the last write time.\n");
- if (written != 1) {
+ written = smbcli_write(cli->tree, fnum1, 0, "0123456789", 1, 10);
+
+ if (written != 10) {
printf("write failed - wrote %d bytes (%s)\n", written, __location__);
return False;
}
+ /* Just to prove to tridge that the an smbflush has no effect on
+ the write time :-). The setfileinfo IS STICKY. JRA. */
+
+ printf("Doing flush after write\n");
+
+ flsh.in.fnum = fnum1;
+ status = smb_raw_flush(cli->tree, &flsh);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("smbflush failed: %s\n", nt_errstr(status)));
+ return False;
+ }
+
t = time(NULL);
/* Once the time was set using setfileinfo then it stays set - writes