X-Git-Url: https://ruderich.org/simon/gitweb/?p=coloredstderr%2Fcoloredstderr.git;a=blobdiff_plain;f=src%2Ftrackfds.h;h=00b3b6e3b55da47e7c66453e609e6b7754a6071d;hp=b9089bbd25b0444772c6442ca27dedd3ac7e4334;hb=f30dbbd26d18e3014762ccc37b8e5ab65b596b35;hpb=6d6ad4423ae87771bd44f90006a648ec03931961 diff --git a/src/trackfds.h b/src/trackfds.h index b9089bb..00b3b6e 100644 --- a/src/trackfds.h +++ b/src/trackfds.h @@ -169,7 +169,7 @@ static char *update_environment_buffer_entry(char *x, int fd) { assert(fd >= 0); int length = snprintf(x, 10 + 1, "%d", fd); - if (length >= 10 + 1) { + if (length >= 10 + 1 || length <= 0 /* shouldn't happen */) { /* Integer too big to fit the buffer, skip it. */ #ifdef WARNING warning("update_environment_buffer_entry(): truncated fd: %d [%d]\n", @@ -325,7 +325,7 @@ static int tracked_fds_find_slow(int fd) noinline; * they are not called often enough. */ inline static int tracked_fds_find(int fd) always_inline; -static int tracked_fds_find(int fd) { +inline static int tracked_fds_find(int fd) { assert(fd >= 0); if (fd < TRACKFDS_STATIC_COUNT) {