From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14086 invoked by alias); 6 Jun 2013 05:56:59 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 14057 invoked by uid 48); 6 Jun 2013 05:56:56 -0000 From: "lizhijian at cn dot fujitsu.com" To: glibc-bugs@sourceware.org Subject: [Bug libc/15589] freopen would close oldfd even though oldfd is same as newfd Date: Thu, 06 Jun 2013 05:56:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.16 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lizhijian at cn dot fujitsu.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00037.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=3D15589 --- Comment #2 from lizhijian --- > # ./freopen-test > [E+] freopen error(No such file or directory) > [S+] stat return error(Bad file descriptor) > [E+] freopen return error(No such file or directory) >=20 sorry ,make some miss,forget to create testfile. # touch file1 file2 test ouput as follows=EF=BC=88glibc=3D2.16=EF=BC=89: # ./freopen-test [S+] close stdin [S+] stat return error(Bad file descriptor) [E+] freopen return success, but the newfd was closed --=20 You are receiving this mail because: You are on the CC list for the bug. >>From glibc-bugs-return-18859-listarch-glibc-bugs=sources.redhat.com@sourceware.org Thu Jun 06 06:23:44 2013 Return-Path: Delivered-To: listarch-glibc-bugs@sources.redhat.com Received: (qmail 26990 invoked by alias); 6 Jun 2013 06:23:44 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Delivered-To: mailing list glibc-bugs@sourceware.org Received: (qmail 26956 invoked by uid 48); 6 Jun 2013 06:23:38 -0000 From: "lizhijian at cn dot fujitsu.com" To: glibc-bugs@sourceware.org Subject: [Bug libc/15589] freopen would close oldfd even though oldfd is same as newfd Date: Thu, 06 Jun 2013 06:23:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.16 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lizhijian at cn dot fujitsu.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00038.txt.bz2 Content-length: 418 http://sourceware.org/bugzilla/show_bug.cgi?id=15589 --- Comment #3 from lizhijian --- Created attachment 7059 --> http://sourceware.org/bugzilla/attachment.cgi?id=7059&action=edit patch for freopen When newfd is same as oldfd, __dup3 return -1 and set errno EINVAL In this case, it don't close oldfd -- You are receiving this mail because: You are on the CC list for the bug.