mirror of
https://github.com/systemd/systemd
synced 2024-09-15 22:30:22 +00:00
basic/terminal-util: add check for poll timeout in get_default_background_color
Currently the return value 0 is not checked for, this indicates a timeout and should be handled to prevent doing a blocking read on a file descriptor with no data ready.
This commit is contained in:
parent
39af486a7f
commit
9924d3c595
|
@ -1744,6 +1744,10 @@ int get_default_background_color(double *ret_red, double *ret_green, double *ret
|
|||
r = fd_wait_for_event(STDIN_FILENO, POLLIN, usec_sub_unsigned(end, n));
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
if (r == 0) {
|
||||
r = -EOPNOTSUPP;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
ssize_t l;
|
||||
l = read(STDIN_FILENO, buf, sizeof(buf) - buf_full);
|
||||
|
|
Loading…
Reference in a new issue