firstboot: actually accept empty input to mean skip
We'd loop if the input was empty. We need to return to the caller.
This commit is contained in:
parent
ee41670ffb
commit
03d9429468
|
@ -200,38 +200,33 @@ int ask_char(char *ret, const char *replies, const char *fmt, ...) {
|
|||
}
|
||||
|
||||
int ask_string(char **ret, const char *text, ...) {
|
||||
_cleanup_free_ char *line = NULL;
|
||||
va_list ap;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
assert(text);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *line = NULL;
|
||||
va_list ap;
|
||||
if (colors_enabled())
|
||||
fputs(ANSI_HIGHLIGHT, stdout);
|
||||
|
||||
if (colors_enabled())
|
||||
fputs(ANSI_HIGHLIGHT, stdout);
|
||||
va_start(ap, text);
|
||||
vprintf(text, ap);
|
||||
va_end(ap);
|
||||
|
||||
va_start(ap, text);
|
||||
vprintf(text, ap);
|
||||
va_end(ap);
|
||||
if (colors_enabled())
|
||||
fputs(ANSI_NORMAL, stdout);
|
||||
|
||||
if (colors_enabled())
|
||||
fputs(ANSI_NORMAL, stdout);
|
||||
fflush(stdout);
|
||||
|
||||
fflush(stdout);
|
||||
r = read_line(stdin, LONG_LINE_MAX, &line);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return -EIO;
|
||||
|
||||
r = read_line(stdin, LONG_LINE_MAX, &line);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return -EIO;
|
||||
|
||||
if (!isempty(line)) {
|
||||
*ret = TAKE_PTR(line);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*ret = TAKE_PTR(line);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int reset_terminal_fd(int fd, bool switch_to_text) {
|
||||
|
|
Loading…
Reference in a new issue