From 86fb267fc817de23a7b95305b2a122510f2376fe Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Fri, 21 Dec 2001 04:30:58 +0000 Subject: 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) --- source3/utils/smbcontrol.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source3/utils/smbcontrol.c') 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); } -- cgit