summaryrefslogtreecommitdiff
path: root/source3/utils/smbcontrol.c
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2001-12-21 04:30:58 +0000
committerMartin Pool <mbp@samba.org>2001-12-21 04:30:58 +0000
commit86fb267fc817de23a7b95305b2a122510f2376fe (patch)
treecb64214a49007f5aeb52d3ad0534d80e797c09e2 /source3/utils/smbcontrol.c
parente27fbe707538bb6b6a52178e3fd51f295b3c1d27 (diff)
downloadsamba-86fb267fc817de23a7b95305b2a122510f2376fe.tar.gz
samba-86fb267fc817de23a7b95305b2a122510f2376fe.tar.bz2
samba-86fb267fc817de23a7b95305b2a122510f2376fe.zip
Add option to pass NULL max_replies to wait_for_replies in case you
don't know how many to expect. (This used to be commit 53f1c0298b526dcacae956453a4b95fff226d0b8)
Diffstat (limited to 'source3/utils/smbcontrol.c')
-rw-r--r--source3/utils/smbcontrol.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 5b968ec999..2d5b20e7ee 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -71,7 +71,8 @@ static BOOL pool_usage_registered = False;
/**
* Wait for replies for up to @p *max_secs seconds, or until @p
- * max_replies are received.
+ * max_replies are received. max_replies may be NULL in which case it
+ * is ignored.
*
* @note This is a pretty lame timeout; all it means is that after
* max_secs we won't look for any more messages.
@@ -80,7 +81,8 @@ static void wait_for_replies(int max_secs, int *max_replies)
{
time_t timeout_end = time(NULL) + max_secs;
- while (((*max_replies)-- > 0) && (time(NULL) < timeout_end)) {
+ while ((!max_replies || (*max_replies)-- > 0)
+ && (time(NULL) < timeout_end)) {
message_dispatch();
}
}
@@ -218,7 +220,6 @@ static BOOL do_command(char *dest, char *msg_name, int iparams, char **params)
{
int i, n, v;
int mtype;
- int n_sent = 0;
BOOL retval=False;
mtype = parse_type(msg_name);
@@ -400,16 +401,18 @@ static BOOL do_command(char *dest, char *msg_name, int iparams, char **params)
break;
case MSG_REQ_POOL_USAGE:
+ {
if (!pool_usage_registered) {
message_register(MSG_POOL_USAGE, pool_usage_cb);
pool_usage_registered = True;
}
if (!send_message(dest, MSG_REQ_POOL_USAGE, NULL, 0, True))
return False;
- wait_for_replies(MAX_WAIT, &n_sent);
+ wait_for_replies(MAX_WAIT, NULL);
break;
}
+ }
return (True);
}