From: Kern Sibbald Date: Sun, 11 May 2014 10:32:44 +0000 (+0200) Subject: Fix error handling in do_alist_prompt X-Git-Tag: Release-7.0.3~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=56cc796dc504ad5d14fad6a55908c9a5ad5f3bad;p=bacula%2Fbacula Fix error handling in do_alist_prompt --- diff --git a/bacula/src/dird/ua_select.c b/bacula/src/dird/ua_select.c index 5f8bc332f5..66b27205b0 100644 --- a/bacula/src/dird/ua_select.c +++ b/bacula/src/dird/ua_select.c @@ -951,6 +951,7 @@ int do_alist_prompt(UAContext *ua, const char *automsg, const char *msg, sprintf(pmsg, "%s (1-%d): ", msg, ua->num_prompts-1); for ( ;; ) { + bool ok = true; /* Either a . or an @ will get you out of the loop */ if (ua->api) user->signal(BNET_SELECT_INPUT); @@ -967,13 +968,16 @@ int do_alist_prompt(UAContext *ua, const char *automsg, const char *msg, while ( (item = sl.next()) > 0) { if (item < 1 || item >= ua->num_prompts) { ua->warning_msg(_("Please enter a number between 1 and %d\n"), ua->num_prompts-1); - continue; + ok = false; + break; } selected->append(bstrdup(ua->prompt[item])); } } - item = selected->size(); - break; + if (ok) { + item = selected->size(); + break; + } } done: