From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12595 invoked by alias); 30 Jan 2003 14:46:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12571 invoked by uid 71); 30 Jan 2003 14:46:01 -0000 Resent-Date: 30 Jan 2003 14:46:01 -0000 Resent-Message-ID: <20030130144601.12570.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, peturr02@ru.is Received: (qmail 12220 invoked by uid 48); 30 Jan 2003 14:44:13 -0000 Message-Id: <20030130144413.12219.qmail@sources.redhat.com> Date: Thu, 30 Jan 2003 14:46:00 -0000 From: peturr02@ru.is Reply-To: peturr02@ru.is To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libstdc++/9507: filebuf::open handles ios_base::ate incorrectly X-SW-Source: 2003-01/txt/msg01729.txt.bz2 List-Id: >Number: 9507 >Category: libstdc++ >Synopsis: filebuf::open handles ios_base::ate incorrectly >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Jan 30 14:46:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: peturr02@ru.is >Release: gcc-3.2.1 >Organization: >Environment: Red Hat Linux 8.0 >Description: When the flag ios_base::ate is passed to basic_filebuf::open, the filebuf tries to seek to the end of the file (as expected). If this seek fails, the file is closed before open returns (also as expected). However, the return value still indicates that open was successful, even though is_open is false after the call to open. >How-To-Repeat: See attachment. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="openseekbug.cc" Content-Disposition: inline; filename="openseekbug.cc" #include #include #include #include #include #include #undef NDEBUG #include int main() { using namespace std; signal(SIGPIPE, SIG_IGN); unlink("xxx"); mkfifo("xxx", S_IRWXU); if (!fork()) { filebuf fbuf; fbuf.open("xxx", ios_base::in); fbuf.sgetc(); fbuf.close(); exit(0); } filebuf fbuf; filebuf* r = fbuf.open("xxx", ios_base::out | ios_base::ate); assert(!fbuf.is_open()); assert(r == NULL); unlink("xxx"); return 0; }