X-Git-Url: https://ruderich.org/simon/gitweb/?p=coloredstderr%2Fcoloredstderr.git;a=blobdiff_plain;f=src%2Fcoloredstderr.c;h=53916f5729c47f79fd1146a33fed2ff4c345613c;hp=6a10654c7a41ddbd4507de2a9b3aeac67efc55a8;hb=4d10935aeebc7c46d5d018abb93bfec17d653b53;hpb=feff94de6be535f17f06e3c135366b33ab9c0ca3 diff --git a/src/coloredstderr.c b/src/coloredstderr.c index 6a10654..53916f5 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -62,6 +62,9 @@ static int check_handle_fd(int fd) { if (!initialized) { init_from_environment(); } + if (tracked_fds_count == 0) { + return 0; + } /* Never touch anything not going to a terminal - unless we are explicitly * asked to do so. */ @@ -69,9 +72,6 @@ static int check_handle_fd(int fd) { return 0; } - if (tracked_fds_count == 0) { - return 0; - } return tracked_fds_find(fd); } @@ -108,10 +108,10 @@ static void close_fd(int fd) { if (!initialized) { init_from_environment(); } - if (tracked_fds_count == 0) { return; } + tracked_fds_remove(fd); }