Max Bowsher wrote:
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.
Irrespective if this is the only one -today-, I agree 100% and would encourage
you to apply the patch on all three living branches (0.9/1.2/trunk).
I don't think there is any room for copy/append to modify data whatsoever.
Bill
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;