Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-Id: <3.0.5.32.19990228131117.0082c100@pop.ne.mediaone.net> X-Sender: phumblet AT pop DOT ne DOT mediaone DOT net X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32) Date: Sun, 28 Feb 1999 13:11:17 -0500 To: Mumit Khan From: "Pierre A. Humblet" Subject: Re: bug in strip 2.9.4 Cc: bug-gnu-utils AT gnu DOT org, cygwin AT sourceware DOT cygnus DOT com In-Reply-To: References: <3 DOT 0 DOT 5 DOT 32 DOT 19990227183336 DOT 00812600 AT pop DOT ne DOT mediaone DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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) 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