Mail Archives: cygwin/1999/02/28/13:10:29
At 02:00 AM 2/28/99 -0600, Mumit Khan wrote:
>Good catch. We could do something like the following:
>
> int flags = O_RDONLY;
>#ifdef O_BINARY
> flags |= O_BINARY;
>#endif
> fromfd = open (from, flags);
> if (fromfd < 0)
> return -1;
> tofd = creat (to, 0777);
>
>As you note, we also need to handle the descriptor returned by creat
>(which is somewhat equiv to open'ing with a few flags -- O_CREAT |
>O_TRUNC | O_WRONLY).
>
>How about just using setmode on both the descriptors? Would that work?
Yep, I would use open in both places, with O_BINARY if it is defined.
I wouldn't use setmode() because many non-PC based systems do not have
setmode (this is part of a GNU package that should work everywhere).
This bug is unfortunate, the package is otherwise careful with the text/binary issue, e.g. defining flags such as FOPEN_WB for fopen. While I was at it, I did a grep for " open " in the directory and found a suspicious spot in ar.c Not sure if it is actually a bug. Could someone more knowledgeable take a look?
**************
/* Update the timestamp of the symbol map of an archive. */
static void
ranlib_touch (archname)
<snip><snip>
f = open (archname, O_RDWR, 0);
*****************
Pierre
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -