Emulate pipe2() on systems without it.

This commit is contained in:
Todd C. Miller
2017-03-13 12:11:51 -06:00
parent b63df21ba5
commit 7aa89c49b5
8 changed files with 106 additions and 1 deletions

View File

@@ -202,6 +202,11 @@
# endif
#endif
/* For pipe2() emulation. */
#if !defined(HAVE_PIPE2) && defined(O_NONBLOCK) && !defined(O_CLOEXEC)
# define O_CLOEXEC 0x80000000
#endif
/*
* BSD defines these in <sys/param.h> but we don't include that anymore.
*/
@@ -520,5 +525,10 @@ __dso_public void sudo_vsyslog(int pri, const char *fmt, va_list ap);
# undef vsyslog
# define vsyslog(_a, _b, _c) sudo_vsyslog((_a), (_b), (_c))
#endif /* HAVE_VSYSLOG */
#ifndef HAVE_PIPE2
__dso_public int sudo_pipe2(int fildes[2], int flags);
# undef pipe2
# define pipe2(_a, _b) sudo_pipe2((_a), (_b))
#endif /* HAVE_PIPE2 */
#endif /* SUDO_COMPAT_H */