strace.c: check return code of never failing fcntl call

Because the kernel cannot be trusted.

* strace.c (set_cloexec_flag): Call perror_msg_and_die if fcntl(F_SETFD)
has failed.
This commit is contained in:
Eugene Syromyatnikov 2018-05-02 20:59:32 +02:00 committed by Dmitry V. Levin
parent 55d3c559e4
commit 37935cca18

View File

@ -421,7 +421,8 @@ set_cloexec_flag(int fd)
if (flags == newflags)
return;
fcntl(fd, F_SETFD, newflags); /* never fails */
if (fcntl(fd, F_SETFD, newflags)) /* never fails */
perror_msg_and_die("fcntl(%d, F_SETFD, %#x)", fd, newflags);
}
static void