summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-05-24 10:06:38 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-05-24 10:06:38 +0000
commitd32c66adc4c9a34935965b3befb65f8769c80fdb (patch)
tree54e968c522da39eb200536bd6f318c177757d4b7 /file_io
parentcf357d0d2fd70fc778bf8e23f8fed064a6ddcdcd (diff)
downloadlibapr-d32c66adc4c9a34935965b3befb65f8769c80fdb.tar.gz
* 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
Diffstat (limited to 'file_io')
-rw-r--r--file_io/unix/copy.c14
1 files changed, 12 insertions, 2 deletions
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;