diff options
Diffstat (limited to 'file_io/unix/copy.c')
-rw-r--r-- | file_io/unix/copy.c | 14 |
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; |