summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/file.c b/fs/file.c
index 6f6eb2b03af5..c6986dce0334 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -236,7 +236,8 @@ static inline void __set_close_on_exec(int fd, struct fdtable *fdt)
static inline void __clear_close_on_exec(int fd, struct fdtable *fdt)
{
- __clear_bit(fd, fdt->close_on_exec);
+ if (test_bit(fd, fdt->close_on_exec))
+ __clear_bit(fd, fdt->close_on_exec);
}
static inline void __set_open_fd(unsigned int fd, struct fdtable *fdt)