Added configure check for pread/pwrite.

oldstable
Alexandre Julliard 2002-01-07 21:00:27 +00:00
parent 99a5cfea91
commit f1a0de996a
6 changed files with 134 additions and 61 deletions

124
configure vendored
View File

@ -5760,6 +5760,8 @@ for ac_func in \
lstat \
memmove \
mmap \
pread \
pwrite \
rfork \
select \
sendmsg \
@ -5778,12 +5780,12 @@ for ac_func in \
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5782: checking for $ac_func" >&5
echo "configure:5784: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5787 "configure"
#line 5789 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -5806,7 +5808,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -5890,17 +5892,17 @@ for ac_hdr in \
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:5894: checking for $ac_hdr" >&5
echo "configure:5896: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5899 "configure"
#line 5901 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:5906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -5927,12 +5929,12 @@ fi
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
echo "configure:5931: checking whether stat file-mode macros are broken" >&5
echo "configure:5933: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5936 "configure"
#line 5938 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -5985,12 +5987,12 @@ fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:5989: checking for working const" >&5
echo "configure:5991: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5994 "configure"
#line 5996 "configure"
#include "confdefs.h"
int main() {
@ -6039,7 +6041,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:6043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -6060,21 +6062,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
echo "configure:6064: checking for inline" >&5
echo "configure:6066: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
#line 6071 "configure"
#line 6073 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
if { (eval echo configure:6078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@ -6100,12 +6102,12 @@ EOF
esac
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:6104: checking for ANSI C header files" >&5
echo "configure:6106: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6109 "configure"
#line 6111 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -6113,7 +6115,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6117: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:6119: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -6130,7 +6132,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 6134 "configure"
#line 6136 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -6148,7 +6150,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 6152 "configure"
#line 6154 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -6169,7 +6171,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 6173 "configure"
#line 6175 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -6180,7 +6182,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:6184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:6186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -6204,12 +6206,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:6208: checking for size_t" >&5
echo "configure:6210: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6213 "configure"
#line 6215 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -6237,7 +6239,7 @@ EOF
fi
echo $ac_n "checking size of long long""... $ac_c" 1>&6
echo "configure:6241: checking size of long long" >&5
echo "configure:6243: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6245,7 +6247,7 @@ else
ac_cv_sizeof_long_long=0
else
cat > conftest.$ac_ext <<EOF
#line 6249 "configure"
#line 6251 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
@ -6257,7 +6259,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:6261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:6263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
@ -6278,12 +6280,12 @@ EOF
echo $ac_n "checking whether linux/input.h is for real""... $ac_c" 1>&6
echo "configure:6282: checking whether linux/input.h is for real" >&5
echo "configure:6284: checking whether linux/input.h is for real" >&5
if eval "test \"`echo '$''{'wine_cv_linux_input_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6287 "configure"
#line 6289 "configure"
#include "confdefs.h"
#include <linux/input.h>
@ -6296,7 +6298,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_linux_input_h=yes
else
@ -6320,12 +6322,12 @@ EOF
echo $ac_n "checking whether we can use re-entrant gethostbyname_r Linux style""... $ac_c" 1>&6
echo "configure:6324: checking whether we can use re-entrant gethostbyname_r Linux style" >&5
echo "configure:6326: checking whether we can use re-entrant gethostbyname_r Linux style" >&5
if eval "test \"`echo '$''{'wine_cv_linux_gethostbyname_r_6'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6329 "configure"
#line 6331 "configure"
#include "confdefs.h"
#include <netdb.h>
@ -6346,7 +6348,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_linux_gethostbyname_r_6=yes
else
@ -6372,12 +6374,12 @@ EOF
if test "$ac_cv_header_linux_joystick_h" = "yes"
then
echo $ac_n "checking whether linux/joystick.h uses the Linux 2.2+ API""... $ac_c" 1>&6
echo "configure:6376: checking whether linux/joystick.h uses the Linux 2.2+ API" >&5
echo "configure:6378: checking whether linux/joystick.h uses the Linux 2.2+ API" >&5
if eval "test \"`echo '$''{'wine_cv_linux_joystick_22_api'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6381 "configure"
#line 6383 "configure"
#include "confdefs.h"
#include <sys/ioctl.h>
@ -6392,7 +6394,7 @@ int main() {
/*empty*/
; return 0; }
EOF
if { (eval echo configure:6396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_linux_joystick_22_api=yes
else
@ -6419,12 +6421,12 @@ fi
if test "$ac_cv_header_sys_vfs_h" = "yes"
then
echo $ac_n "checking whether sys/vfs.h defines statfs""... $ac_c" 1>&6
echo "configure:6423: checking whether sys/vfs.h defines statfs" >&5
echo "configure:6425: checking whether sys/vfs.h defines statfs" >&5
if eval "test \"`echo '$''{'wine_cv_sys_vfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6428 "configure"
#line 6430 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6441,7 +6443,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_vfs_has_statfs=yes
else
@ -6468,12 +6470,12 @@ fi
if test "$ac_cv_header_sys_statfs_h" = "yes"
then
echo $ac_n "checking whether sys/statfs.h defines statfs""... $ac_c" 1>&6
echo "configure:6472: checking whether sys/statfs.h defines statfs" >&5
echo "configure:6474: checking whether sys/statfs.h defines statfs" >&5
if eval "test \"`echo '$''{'wine_cv_sys_statfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6477 "configure"
#line 6479 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6488,7 +6490,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_statfs_has_statfs=yes
else
@ -6515,12 +6517,12 @@ fi
if test "$ac_cv_header_sys_mount_h" = "yes"
then
echo $ac_n "checking whether sys/mount.h defines statfs""... $ac_c" 1>&6
echo "configure:6519: checking whether sys/mount.h defines statfs" >&5
echo "configure:6521: checking whether sys/mount.h defines statfs" >&5
if eval "test \"`echo '$''{'wine_cv_sys_mount_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6524 "configure"
#line 6526 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6535,7 +6537,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_mount_has_statfs=yes
else
@ -6561,7 +6563,7 @@ fi
echo $ac_n "checking for statfs.f_bfree""... $ac_c" 1>&6
echo "configure:6565: checking for statfs.f_bfree" >&5
echo "configure:6567: checking for statfs.f_bfree" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bfree'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6570,7 +6572,7 @@ else
wine_cv_statfs_bfree=no
else
cat > conftest.$ac_ext <<EOF
#line 6574 "configure"
#line 6576 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6597,7 +6599,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6603: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bfree=yes
else
@ -6621,7 +6623,7 @@ EOF
fi
echo $ac_n "checking for statfs.f_bavail""... $ac_c" 1>&6
echo "configure:6625: checking for statfs.f_bavail" >&5
echo "configure:6627: checking for statfs.f_bavail" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bavail'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6630,7 +6632,7 @@ else
wine_cv_statfs_bavail=no
else
cat > conftest.$ac_ext <<EOF
#line 6634 "configure"
#line 6636 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6657,7 +6659,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6661: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6663: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bavail=yes
else
@ -6682,12 +6684,12 @@ fi
echo $ac_n "checking for msg_accrights in struct msghdr""... $ac_c" 1>&6
echo "configure:6686: checking for msg_accrights in struct msghdr" >&5
echo "configure:6688: checking for msg_accrights in struct msghdr" >&5
if eval "test \"`echo '$''{'ac_cv_c_msg_accrights'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6691 "configure"
#line 6693 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -6695,7 +6697,7 @@ int main() {
struct msghdr hdr; hdr.msg_accrights=0
; return 0; }
EOF
if { (eval echo configure:6699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_msg_accrights="yes"
else
@ -6718,12 +6720,12 @@ fi
echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6
echo "configure:6722: checking for sa_len in struct sockaddr" >&5
echo "configure:6724: checking for sa_len in struct sockaddr" >&5
if eval "test \"`echo '$''{'ac_cv_c_sockaddr_sa_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6727 "configure"
#line 6729 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -6732,7 +6734,7 @@ int main() {
static struct sockaddr addr; addr.sa_len = 1
; return 0; }
EOF
if { (eval echo configure:6736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_sockaddr_sa_len="yes"
else
@ -6755,12 +6757,12 @@ fi
echo $ac_n "checking for sun_len in struct sockaddr_un""... $ac_c" 1>&6
echo "configure:6759: checking for sun_len in struct sockaddr_un" >&5
echo "configure:6761: checking for sun_len in struct sockaddr_un" >&5
if eval "test \"`echo '$''{'ac_cv_c_sockaddr_sun_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6764 "configure"
#line 6766 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -6769,7 +6771,7 @@ int main() {
static struct sockaddr_un addr; addr.sun_len = 1
; return 0; }
EOF
if { (eval echo configure:6773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_sockaddr_sun_len="yes"
else
@ -6792,12 +6794,12 @@ fi
echo $ac_n "checking whether we need to define __i386__""... $ac_c" 1>&6
echo "configure:6796: checking whether we need to define __i386__" >&5
echo "configure:6798: checking whether we need to define __i386__" >&5
if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6801 "configure"
#line 6803 "configure"
#include "confdefs.h"
#if (defined(i386) || defined(__i386)) && !defined(__i386__)
yes

View File

@ -818,6 +818,8 @@ AC_CHECK_FUNCS(\
lstat \
memmove \
mmap \
pread \
pwrite \
rfork \
select \
sendmsg \

View File

@ -121,6 +121,12 @@
/* Define if you have the openpty function. */
#undef HAVE_OPENPTY
/* Define if you have the pread function. */
#undef HAVE_PREAD
/* Define if you have the pwrite function. */
#undef HAVE_PWRITE
/* Define if you have the resizeterm function. */
#undef HAVE_RESIZETERM

View File

@ -14,6 +14,7 @@ extern "C" {
*/
typedef enum tagLOCKTYPE
{
#undef LOCK_WRITE
LOCK_WRITE = 1,
LOCK_EXCLUSIVE = 2,
LOCK_ONLYONCE = 4

View File

@ -10,6 +10,7 @@
# error You must include config.h to use this header
#endif
#define _GNU_SOURCE /* for pread/pwrite */
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
@ -135,6 +136,14 @@ int usleep (unsigned int useconds);
int lstat(const char *file_name, struct stat *buf);
#endif /* HAVE_LSTAT */
#ifndef HAVE_PREAD
ssize_t pread( int fd, void *buf, size_t count, off_t offset );
#endif /* HAVE_PREAD */
#ifndef HAVE_PWRITE
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
#endif /* HAVE_PWRITE */
#ifndef S_ISLNK
#define S_ISLNK(mod) (0)
#endif /* S_ISLNK */

View File

@ -379,6 +379,59 @@ int lstat(const char *file_name, struct stat *buf)
}
#endif /* HAVE_LSTAT */
/***********************************************************************
* pread
*
* FIXME: this is not thread-safe
*/
#ifndef HAVE_PREAD
ssize_t pread( int fd, void *buf, size_t count, off_t offset )
{
ssize_t ret;
off_t old_pos;
if ((old_pos = lseek( fd, 0, SEEK_CUR )) == -1) return -1;
if (lseek( fd, offset, SEEK_SET ) == -1) return -1;
if ((ret = read( fd, buf, count )) == -1)
{
int err = errno; /* save errno */
lseek( fd, old_pos, SEEK_SET );
errno = err;
return -1;
}
if (lseek( fd, old_pos, SEEK_SET ) == -1) return -1;
return ret;
}
#endif /* HAVE_PREAD */
/***********************************************************************
* pwrite
*
* FIXME: this is not thread-safe
*/
#ifndef HAVE_PWRITE
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset )
{
ssize_t ret;
off_t old_pos;
if ((old_pos = lseek( fd, 0, SEEK_CUR )) == -1) return -1;
if (lseek( fd, offset, SEEK_SET ) == -1) return -1;
if ((ret = write( fd, buf, count )) == -1)
{
int err = errno; /* save errno */
lseek( fd, old_pos, SEEK_SET );
errno = err;
return -1;
}
if (lseek( fd, old_pos, SEEK_SET ) == -1) return -1;
return ret;
}
#endif /* HAVE_PWRITE */
/***********************************************************************
* getrlimit
*/