X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Fcoloredstderr.c;h=b2ef2975ef8d6e5ffae8625e925ae5caf46e3523;hb=f369605227fb876e2edb0957a7c6ace98c49f7d3;hp=32b1dd8f106f570535f614c4b410fdcc2f7ffd7e;hpb=abc3d7889f3774717baf5795ffab2efb396d2570;p=coloredstderr%2Fcoloredstderr.git diff --git a/src/coloredstderr.c b/src/coloredstderr.c index 32b1dd8..b2ef297 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -49,7 +49,7 @@ static size_t (*real_fwrite)(const void *, size_t, size_t, FILE *); # include "debug.h" #endif -#include "macros.h" +#include "hookmacros.h" #include "trackfds.h" @@ -280,7 +280,7 @@ int fcntl(int fd, int cmd, int arg) { result = real_fcntl(fd, cmd, arg); /* We only care about duping fds. */ - if (cmd == F_DUPFD) { + if (cmd == F_DUPFD && result != -1) { int saved_errno = errno; dup_fd(fd, result); errno = saved_errno;