[PATCH] rsync on cygwin - textmode config files

Ville Herva vherva at niksula.hut.fi
Thu Feb 21 22:45:04 EST 2002


On Wed, Feb 20, 2002 at 11:17:24AM -0800, you [Martin Pool] wrote:
>
> OK, already fixed.  --no-fork would be good to add in the future -- it
> can be handy for debugging.

As said, I only added the --dont-fork==--no-detach  mostly because I use it
in my scripts. (The original --dont-fork did disable just the fork() call,
not the whole become_daemon() call, so it was slightly different from
--no-detach.)
  
> > O_TEXT and O_BINARY
> 
> Good.
> 
> It might be cleaner to #ifdef on O_BINARY or something that will also
> work on MSVC++.

O_TEXT and O_BINARY also work on MSVC (and propably on most other windows
compilers.)

So perhaps 

#if defined(_WIN32) || defined(__CYGWIN__)
#define TEXT O_TEXT
#define BINARY O_BINARY
#else
#define TEXT 0
#define BINARY 0
#endif

and

       fd = open(fname, O_RDONLY | TEXT)

(not sure what to call those -- "TEXT"/"BINARY" might collide with
something?)

Or is 

#if !defined(O_TEXT)
#define O_TEXT 0
#endif
#if !defined(O_BINARY)
#define O_BINARY 0
#endif

better?
 
> Can't you say "rt" as an fopen mode?  That works on all C platforms
> that I know, and avoids the ifdef.

I'm not sure what I was thinking back then :) (This dates back to few years
ago). Perhaps I tried "rt", but it didn't work or something. Or perhaps it
was just my thinko. It should work now with cygwin, you're right.

> > (3) avoid perm check on password file
> 
> This seems good, though again perhaps ideally we would ifdef for "the
> windows platform" rather than "cygwin".

Ok, how about 

#if defined(_WIN32) || defined(__CYGWIN__)

?


-- v --

v at iki.fi




More information about the rsync mailing list