diff --git a/src/basic/log.c b/src/basic/log.c index cac17a76f4d..c5e16d669b0 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -1460,7 +1460,7 @@ int log_dup_console(void) { /* Duplicate the fd we use for fd logging if it's < 3 and use the copy from now on. This call is useful * whenever we want to continue logging through the original fd, but want to rearrange stderr. */ - if (console_fd >= 3) + if (console_fd < 0 || console_fd >= 3) return 0; copy = fcntl(console_fd, F_DUPFD_CLOEXEC, 3);