X-Git-Url: https://ruderich.org/simon/gitweb/?p=coloredstderr%2Fcoloredstderr.git;a=blobdiff_plain;f=src%2Fcoloredstderr.c;h=b2ef2975ef8d6e5ffae8625e925ae5caf46e3523;hp=dbcfd235cf649a7a412b6f1ca6f896c1bbf71c71;hb=f369605227fb876e2edb0957a7c6ace98c49f7d3;hpb=6d15f6c9902c1ac879ce0dee201ff8c6c66afaf1 diff --git a/src/coloredstderr.c b/src/coloredstderr.c index dbcfd23..b2ef297 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -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;