/* Open a 2nd input fd, in non-blocking mode, so that we won't ever hang in read() should someone
* else process the POLLIN. */
- nonblock_input_fd = fd_reopen(STDIN_FILENO, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
- if (nonblock_input_fd < 0)
- return nonblock_input_fd;
+ nonblock_input_fd = r = fd_reopen(STDIN_FILENO, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
+ if (r < 0)
+ goto finish;
usec_t end = usec_add(now(CLOCK_MONOTONIC), 333 * USEC_PER_MSEC);
char buf[STRLEN(ANSI_OSC "11;rgb:0/0/0" ANSI_ST)]; /* shortest possible reply */
unsigned *ret_columns) {
_cleanup_close_ int nonblock_input_fd = -EBADF;
+ int r;
assert(input_fd >= 0);
assert(output_fd >= 0);
- int r;
-
/* Tries to determine the terminal dimension by means of ANSI sequences rather than TIOCGWINSZ
* ioctl(). Why bother with this? The ioctl() information is often incorrect on serial terminals
* (since there's no handshake or protocol to determine the right dimensions in RS232), but since the
/* Open a 2nd input fd, in non-blocking mode, so that we won't ever hang in read() should someone
* else process the POLLIN. */
- nonblock_input_fd = fd_reopen(input_fd, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
- if (nonblock_input_fd < 0)
- return nonblock_input_fd;
+ nonblock_input_fd = r = fd_reopen(input_fd, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
+ if (r < 0)
+ goto finish;
usec_t end = usec_add(now(CLOCK_MONOTONIC), 333 * USEC_PER_MSEC);
char buf[STRLEN("\x1B[1;1R")]; /* The shortest valid reply possible */