diff mbox series

do not set close-on-exec flag on descriptor if it was already set

Message ID 5948808.FfnTCzJfH2@devpool35 (mailing list archive)
State New, archived
Headers show
Series do not set close-on-exec flag on descriptor if it was already set | expand

Commit Message

Rolf Eike Beer Feb. 11, 2020, 10:22 a.m. UTC
There is no need to set this again if O_CLOEXEC is supported.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
 include/local.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jaroslav Kysela Feb. 11, 2020, 11:13 a.m. UTC | #1
Dne 11. 02. 20 v 11:22 Rolf Eike Beer napsal(a):
> There is no need to set this again if O_CLOEXEC is supported.

Thanks. Applied.

				Jroslav

> 
> Signed-off-by: Rolf Eike Beer <eb@emlix.com>
> ---
>   include/local.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> 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;
>   }
>   
>
diff mbox series

Patch

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