async_smb.c: convert cli->timeout properly
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 10 May 2011 08:03:11 +0000 (17:33 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 10 May 2011 10:09:07 +0000 (12:09 +0200)
I have a test failure on my 32-bit Ubuntu system, in that
samba3.smbtorture_s3.plain(s3dc).LOCK9 immediately times out (rather than
waiting 5 seconds for the child).

Debugging revealed this code: timeout is in ms and is set to > 1000 in
various places.  The code dates from 2002, and other perturbations didn't
reveal why it breaks now, but fix it anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Tue May 10 12:09:07 CEST 2011 on sn-devel-104

source3/libsmb/async_smb.c

index 0e4392460b2279e32ee3f10ff043d2a698ec8ad2..82dbc74e5bff286681348110745a1b4224110195 100644 (file)
@@ -426,7 +426,8 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
        state->iov_count = iov_count + 3;
 
        if (cli->timeout) {
-               endtime = timeval_current_ofs(0, cli->timeout * 1000);
+               endtime = timeval_current_ofs(cli->timeout / 1000,
+                                             (cli->timeout % 1000) * 1000);
                if (!tevent_req_set_endtime(result, ev, endtime)) {
                        tevent_req_nomem(NULL, result);
                }