Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <42DBFEE2.8080906@redhat.com> Date: Mon, 18 Jul 2005 15:11:30 -0400 From: Jeff Johnston User-Agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513) MIME-Version: 1.0 To: Dave Korn Cc: cygwin AT cygwin DOT com, newlib AT sourceware DOT org Subject: Re: bug in freopen References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Dave Korn wrote: > ----Original Message---- > >>From: Eric Blake >>Sent: 15 July 2005 00:14 > > >>POSIX requires that freopen(NULL, mode, f) reopen f in the new >>mode, and allows implementations the option of not even closing >>f in the first place. But in cygwin, it is failing with EFAULT, which is >>not even one of the errors allowed by POSIX. >> >>http://www.opengroup.org/susv3xsh/freopen.html >> >>#include >>#include >>int main(void) >>{ >> FILE* f = freopen (NULL, "rb", stdin); /* Ensure that stdin is binary >> */ printf ("file is %s, errno %d:%s\n", f ? "good" : "null", errno, >> strerror(errno)); >> return 0; >>} >> >>CVS coreutils recently switched to this idiom, replacing its former >>use of the nonstandard and setmode() with something >>that is required by the standards. But until this bug is fixed, CVS >>coreutils will not work with cygwin. The strace in cygwin shows >>that newlib tried to perform open(NULL), which is the cause of >>the EFAULT. > > > > I could take a look at this over the weekend if nobody gets to it first :) > A little late, but please do. I'm a little busy at the moment. -- Jeff J. > > cheers, > DaveK -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/