From c2b1c0366efa08b2ceca7ab67ca5cae761173230 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 12 Jun 2008 00:01:21 +0300 Subject: [PATCH] HP-UX: pread() and pwrite() are broken, use our own implementation. --HG-- branch : HEAD --- configure.in | 1 + src/lib/compat.c | 6 ++---- src/lib/compat.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index 23fa3a42f2..a03fdfc2de 100644 --- a/configure.in +++ b/configure.in @@ -613,6 +613,7 @@ dnl * OS specific options case "$host_os" in hpux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" + AC_DEFINE(PREAD_BROKEN,, Defint if pread/pwrite implementation is broken) ;; *) ;; diff --git a/src/lib/compat.c b/src/lib/compat.c index e850542648..29cfa494d3 100644 --- a/src/lib/compat.c +++ b/src/lib/compat.c @@ -107,7 +107,7 @@ ssize_t my_writev(int fd, const struct iovec *iov, int iov_len) } #endif -#ifndef HAVE_PREAD +#if !defined(HAVE_PREAD) || defined(PREAD_BROKEN) ssize_t my_pread(int fd, void *buf, size_t count, off_t offset) { ssize_t ret; @@ -149,9 +149,7 @@ ssize_t my_pwrite(int fd, const void *buf, size_t count, off_t offset) return -1; return ret; } -#endif - -#ifdef PREAD_WRAPPERS +#elif defined(PREAD_WRAPPERS) ssize_t my_pread(int fd, void *buf, size_t count, off_t offset) { diff --git a/src/lib/compat.h b/src/lib/compat.h index 5a934b29f5..1e76582679 100644 --- a/src/lib/compat.h +++ b/src/lib/compat.h @@ -160,7 +160,7 @@ struct iovec; ssize_t my_writev(int fd, const struct iovec *iov, int iov_len); #endif -#if !defined (HAVE_PREAD) || defined (PREAD_WRAPPERS) +#if !defined(HAVE_PREAD) || defined(PREAD_WRAPPERS) || defined(PREAD_BROKEN) # ifndef IN_COMPAT_C # define pread my_pread # define pwrite my_pwrite -- 2.47.3