From d32c66adc4c9a34935965b3befb65f8769c80fdb Mon Sep 17 00:00:00 2001 From: jorton Date: Mon, 24 May 2004 10:06:38 +0000 Subject: * configure.in: Check for fstat64. * file_io/unix/copy.c (apr_file_transfer_contents): Allow copying >2Gb files and their permission bits if fstat64() is available; remove redundant NULL-initializers. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/APR_0_9_BRANCH@65122 13f79535-47bb-0310-9956-ffa450edef68 --- file_io/unix/copy.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'file_io') diff --git a/file_io/unix/copy.c b/file_io/unix/copy.c index 3fd27eb34..a9452611c 100644 --- a/file_io/unix/copy.c +++ b/file_io/unix/copy.c @@ -22,9 +22,8 @@ static apr_status_t apr_file_transfer_contents(const char *from_path, apr_fileperms_t to_perms, apr_pool_t *pool) { - apr_file_t *s = NULL, *d = NULL; /* init to null important for APR */ + apr_file_t *s, *d; apr_status_t status; - apr_finfo_t finfo; apr_fileperms_t perms; /* Open source file. */ @@ -35,12 +34,23 @@ static apr_status_t apr_file_transfer_contents(const char *from_path, /* Maybe get its permissions. */ if (to_perms == APR_FILE_SOURCE_PERMS) { +#if defined(HAVE_FSTAT64) && defined(O_LARGEFILE) && SIZEOF_OFF_T == 4 + struct stat64 st; + + if (fstat64(s->filedes, &st) != 0) + return errno; + + perms = apr_unix_mode2perms(st.st_mode); +#else + apr_finfo_t finfo; + status = apr_file_info_get(&finfo, APR_FINFO_PROT, s); if (status != APR_SUCCESS && status != APR_INCOMPLETE) { apr_file_close(s); /* toss any error */ return status; } perms = finfo.protection; +#endif } else perms = to_perms; -- cgit v1.2.1