This is the mail archive of the cygwin@sourceware.cygnus.com
mailing list for the Cygwin project. See the Cygwin
home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]
Re: bug in strip 2.9.4
- To: Mumit Khan <khan@xraylith.wisc.edu>
- Subject: Re: bug in strip 2.9.4
- From: "Pierre A. Humblet" <Pierre.Humblet@eurecom.fr>
- Date: Sun, 28 Feb 1999 13:11:17 -0500
- Cc: bug-gnu-utils@gnu.org, cygwin@sourceware.cygnus.com
- Delivered-To: listarch-cygwin@sourceware.cygnus.com
- Delivered-To: mailing list cygwin@sourceware.cygnus.com
- In-Reply-To: <Pine.SUN.3.93.990228014948.11378A-100000@modi.xraylith.wisc.edu>
- Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
- References: <3.0.5.32.19990227183336.00812600@pop.ne.mediaone.net>
- Sender: cygwin-owner@sourceware.cygnus.com
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@sourceware.cygnus.com