From: Rolf Eike Beer Date: Tue, 11 Feb 2020 10:22:18 +0000 (+0100) Subject: do not set close-on-exec flag on descriptor if it was already set X-Git-Tag: v1.2.2~5 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=b367274b4dcdd1e83e6e7211dd2c08df05c8a998;p=alsa-lib.git do not set close-on-exec flag on descriptor if it was already set There is no need to set this again if O_CLOEXEC is supported. Signed-off-by: Rolf Eike Beer Signed-off-by: Jaroslav Kysela --- diff --git a/include/local.h b/include/local.h index ea0ec32d..ed6ba936 100644 --- a/include/local.h +++ b/include/local.h @@ -320,8 +320,10 @@ static inline int snd_open_device(const char *filename, int fmode) fd = rsm_open_device(filename, fmode); } #endif +#ifndef O_CLOEXEC if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif return fd; }