[PATCH] open O_TEXT and O_BINARY for cygwin/windows
vherva at niksula.hut.fi
Fri Jan 24 06:58:01 EST 2003
On Thu, Jan 23, 2003 at 01:55:40PM -0600, you [Dave Dykstra] wrote:
> Why did you skip the fopen in log.c, which appends to the log file?
I thought about that for a while. My reasoning was that the log file is
probably read with unix/cygwin tools anyway - if not, the administrator is
free to mount the filesystem binary or ascii. So I didn't want to enforce
CR/LF on anyone.
In general, I think forcing ascii makes more sense for reading than writing,
because it in most imaginable cases will do no harm.
> Because of the question about whether or not the "t" is ignored on all
> platforms, I'm a little nervous about putting this into 2.5.6.
It could be ifdefed, would it be safe to assume the following to work?
#define O_TEXT 0
#define O_TEXT_STR ""
#define O_TEXT_STR "t"
#define O_BINARY 0
#define O_BINARY_STR ""
#define O_BINARY_STR "b"
and then instead of
fopen(foo, "r" O_TEXT_STR);
> I don't have any problem with it for 2.6.0. Maybe it should be just in
> the 'patches' directory this time.
> Did you check to see whether any of the code that's reading config files
> is ignoring carriage returns at the end of lines anyway?
ISTR at least the password files were not recognized and I *think*
rsync.conf was not parsed correctly when I originally wrote the patch.
Looking at the source, though
- exclude.c uses fgets() to read the lines from exclude file. I don't think
it handles '\r'
- param.c Ignores all '\r' in values, so rsync.conf should be fine. I'm not
sure, whether reading the file as text would be more elegant (in theory
there _could_ be other issues than the \r\n thing...)
- authentivate.c seems to skip '\r' for passwords as well.
So I guess you are right for the most crucial part of code (as of current
-- v --
v at iki.fi
More information about the rsync