diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2019-11-27 18:03:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2019-11-27 18:03:00 +0000 |
commit | 5ca80ffd75a08c06332bf9ea7394e23e82a2368b (patch) | |
tree | a1d0d246ccfe94a7476cb05893d25eb08cded42f | |
parent | ce3291e1906300596ebd0266103522e5466adc39 (diff) | |
download | strace-5ca80ffd75a08c06332bf9ea7394e23e82a2368b.tar.gz |
Use an LFS version of fcntl function when available
glibc-2.28 introduced fcntl64 as an LFS version of fcntl function,
use this new function when available.
* configure.ac (AC_CHECK_FUNCS): Add fcntl64.
* largefile_wrappers.h (fcntl_fd): New macro.
* strace.c (set_cloexec_flag): Use it instead of fcntl.
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | largefile_wrappers.h | 6 | ||||
-rw-r--r-- | strace.c | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 2cf5110c0..f92f9e050 100644 --- a/configure.ac +++ b/configure.ac @@ -266,6 +266,7 @@ AC_CHECK_FUNCS(m4_normalize([ be64toh fallocate fanotify_mark + fcntl64 fopen64 fork fputs_unlocked diff --git a/largefile_wrappers.h b/largefile_wrappers.h index 902dc98a4..b52e22189 100644 --- a/largefile_wrappers.h +++ b/largefile_wrappers.h @@ -24,6 +24,11 @@ # else # define fopen_stream fopen # endif +# ifdef HAVE_FCNTL64 +# define fcntl_fd fcntl64 +# else +# define fcntl_fd fcntl +# endif # define strace_stat_t struct stat64 # define stat_file stat64 # define struct_dirent struct dirent64 @@ -33,6 +38,7 @@ # else # define open_file open # define fopen_stream fopen +# define fcntl_fd fcntl # define strace_stat_t struct stat # define stat_file stat # define struct_dirent struct dirent @@ -422,7 +422,7 @@ set_cloexec_flag(int fd) { int flags, newflags; - flags = fcntl(fd, F_GETFD); + flags = fcntl_fd(fd, F_GETFD); if (flags < 0) { /* Can happen only if fd is bad. * Should never happen: if it does, we have a bug @@ -436,7 +436,7 @@ set_cloexec_flag(int fd) if (flags == newflags) return; - if (fcntl(fd, F_SETFD, newflags)) /* never fails */ + if (fcntl_fd(fd, F_SETFD, newflags)) /* never fails */ perror_msg_and_die("fcntl(%d, F_SETFD, %#x)", fd, newflags); } |