mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
xz: Use pipe2() if available.
This commit is contained in:
parent
117d962685
commit
7a11c4a8e5
2 changed files with 10 additions and 3 deletions
|
@ -626,8 +626,8 @@ gl_GETOPT
|
||||||
# Find the best function to set timestamps.
|
# Find the best function to set timestamps.
|
||||||
AC_CHECK_FUNCS([futimens futimes futimesat utimes utime], [break])
|
AC_CHECK_FUNCS([futimens futimes futimesat utimes utime], [break])
|
||||||
|
|
||||||
# This is nice to have but not mandatory.
|
# These are nice to have but not mandatory.
|
||||||
AC_CHECK_FUNCS([posix_fadvise])
|
AC_CHECK_FUNCS([posix_fadvise pipe2])
|
||||||
|
|
||||||
TUKLIB_PROGNAME
|
TUKLIB_PROGNAME
|
||||||
TUKLIB_INTEGER
|
TUKLIB_INTEGER
|
||||||
|
|
|
@ -82,7 +82,13 @@ io_init(void)
|
||||||
// we are root.
|
// we are root.
|
||||||
warn_fchown = geteuid() == 0;
|
warn_fchown = geteuid() == 0;
|
||||||
|
|
||||||
// Create a pipe for the self-pipe trick.
|
// Create a pipe for the self-pipe trick. If pipe2() is available,
|
||||||
|
// we can avoid the fcntl() calls.
|
||||||
|
# ifdef HAVE_PIPE2
|
||||||
|
if (pipe2(user_abort_pipe, O_NONBLOCK))
|
||||||
|
message_fatal(_("Error creating a pipe: %s"),
|
||||||
|
strerror(errno));
|
||||||
|
# else
|
||||||
if (pipe(user_abort_pipe))
|
if (pipe(user_abort_pipe))
|
||||||
message_fatal(_("Error creating a pipe: %s"),
|
message_fatal(_("Error creating a pipe: %s"),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@ -95,6 +101,7 @@ io_init(void)
|
||||||
message_fatal(_("Error creating a pipe: %s"),
|
message_fatal(_("Error creating a pipe: %s"),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __DJGPP__
|
#ifdef __DJGPP__
|
||||||
|
|
Loading…
Reference in a new issue