apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Bowsher <ma...@ukf.net>
Subject apr_file_copy/append should be binary?
Date Sat, 11 Mar 2006 11:43:20 GMT
It seems to me that apr_file_copy() and apr_file_append() should behave
in a raw byte-for-byte manner, always.

Therefore, I propose to specify APR_BINARY in all associated
apr_file_open() calls.


The only platform I *know* that this affects is Cygwin.

Max.



Index: file_io/unix/copy.c
===================================================================
--- file_io/unix/copy.c (revision 385062)
+++ file_io/unix/copy.c (working copy)
@@ -29,7 +29,8 @@
     apr_fileperms_t perms;

     /* Open source file. */
-    status = apr_file_open(&s, from_path, APR_READ, APR_OS_DEFAULT, pool);
+    status = apr_file_open(&s, from_path, APR_READ | APR_BINARY,
+                           APR_OS_DEFAULT, pool);
     if (status)
         return status;

@@ -46,7 +47,7 @@
         perms = to_perms;

     /* Open dest file. */
-    status = apr_file_open(&d, to_path, flags, perms, pool);
+    status = apr_file_open(&d, to_path, flags | APR_BINARY, perms, pool);
     if (status) {
         apr_file_close(s);  /* toss any error */
         return status;


Mime
View raw message