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 <eb@emlix.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Rolf Eike Beer 2020-02-11 11:22:18 +01:00 committed by Jaroslav Kysela
parent 5bc3d4c4c1
commit b367274b4d

View File

@ -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;
}