From f369605227fb876e2edb0957a7c6ace98c49f7d3 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 31 May 2013 18:37:55 +0200 Subject: [PATCH] fcntl(): Don't call dup_fd() if real_fcntl() failed. --- src/coloredstderr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.43.2