summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-08-02 22:58:57 +0200
committerStefan Metzmacher <metze@samba.org>2011-08-03 10:16:18 +0200
commitde71a67a1c442a72a7ab88674430b44d371c09d5 (patch)
tree9f3a01f0b20c63c76f0456a1d7b2942e0c93fea3
parent71c695d8d1ddcb4927daab4ad967f9fcfdff76c7 (diff)
downloadsamba-de71a67a1c442a72a7ab88674430b44d371c09d5.tar.gz
samba-de71a67a1c442a72a7ab88674430b44d371c09d5.tar.bz2
samba-de71a67a1c442a72a7ab88674430b44d371c09d5.zip
s3:libsmb/clifile: make use of cli_set_timeout()
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Wed Aug 3 10:16:18 CEST 2011 on sn-devel-104
-rw-r--r--source3/libsmb/clifile.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 812fcde85e..f9e3cbdced 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -2594,7 +2594,8 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
uint16_t vwv[8];
uint8_t bytes[10];
NTSTATUS status;
- int saved_timeout;
+ unsigned int set_timeout = 0;
+ unsigned int saved_timeout = 0;
SCVAL(vwv + 0, 0, 0xff);
SCVAL(vwv + 0, 1, 0);
@@ -2610,17 +2611,21 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
SIVAL(bytes, 2, offset);
SIVAL(bytes, 6, len);
- saved_timeout = cli->timeout;
-
if (timeout != 0) {
- cli->timeout = (timeout == -1)
- ? 0x7FFFFFFF : (timeout + 2*1000);
+ if (timeout == -1) {
+ set_timeout = 0x7FFFFFFF;
+ } else {
+ set_timeout = timeout + 2*1000;
+ }
+ saved_timeout = cli_set_timeout(cli, set_timeout);
}
status = cli_smb(talloc_tos(), cli, SMBlockingX, 0, 8, vwv,
10, bytes, NULL, 0, NULL, NULL, NULL, NULL);
- cli->timeout = saved_timeout;
+ if (saved_timeout != 0) {
+ cli_set_timeout(cli, saved_timeout);
+ }
return status;
}
@@ -2761,7 +2766,8 @@ NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
{
uint16_t vwv[8];
uint8_t bytes[20];
- int saved_timeout = cli->timeout;
+ unsigned int set_timeout = 0;
+ unsigned int saved_timeout = 0;
int ltype;
NTSTATUS status;
@@ -2786,17 +2792,21 @@ NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
SOFF_T_R(bytes, 4, offset);
SOFF_T_R(bytes, 12, len);
- saved_timeout = cli->timeout;
-
if (timeout != 0) {
- cli->timeout = (timeout == -1)
- ? 0x7FFFFFFF : (timeout + 2*1000);
+ if (timeout == -1) {
+ set_timeout = 0x7FFFFFFF;
+ } else {
+ set_timeout = timeout + 2*1000;
+ }
+ saved_timeout = cli_set_timeout(cli, set_timeout);
}
status = cli_smb(talloc_tos(), cli, SMBlockingX, 0, 8, vwv,
20, bytes, NULL, 0, NULL, NULL, NULL, NULL);
- cli->timeout = saved_timeout;
+ if (saved_timeout != 0) {
+ cli_set_timeout(cli, saved_timeout);
+ }
return status;
}