From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10778 invoked by alias); 23 Dec 2001 16:36:02 -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 10749 invoked by uid 71); 23 Dec 2001 16:36:01 -0000 Resent-Date: 23 Dec 2001 16:36:01 -0000 Resent-Message-ID: <20011223163601.10748.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, kingleo@gmx.at Received:(qmail 10478 invoked by uid 61); 23 Dec 2001 16:33:05 -0000 Message-Id:<20011223163305.10477.qmail@sources.redhat.com> Date: Sun, 23 Dec 2001 08:36:00 -0000 From: kingleo@gmx.at Reply-To: kingleo@gmx.at To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libstdc++/5180: seekp() on fstreams opened in read only mode X-SW-Source: 2001-12/txt/msg01077.txt.bz2 List-Id: >Number: 5180 >Category: libstdc++ >Synopsis: seekp() on fstreams opened in read only mode >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Dec 23 08:36:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Martin Oberzalek >Release: gcc version 3.0.3 >Organization: >Environment: debian/linux/unstable on i386; glibc 2.2.4-7 >Description: if a file is opened via std::fstream in read only mode, and a seekp(0) will be done std::fstream::eof() will never return true. This causes the program to hang in a loop. >How-To-Repeat: just compile the program (no Optimation) and start it by setting as the first option a simple text file. $ echo "foobar" > foo && ./test_bug foo >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-c++src; name="main.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="main.cpp" I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4K CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbiggaW50IGFyZ2MsIGNoYXIqKiBhcmd2ICkK ewoKICBpZiggYXJnYyAhPSAyKQogICAgcmV0dXJuIDE7CgogIGZzdHJlYW0gaW4oIGFyZ3ZbMV0s IHN0ZDo6aW9zOjppbiApOwogIAogIGlmKCAhaW4gKQogICAgewogICAgICBjb3V0IDw8ICJjYW5u b3Qgb3BlbiBmaWxlICIgPDwgZW5kbDsKICAgICAgcmV0dXJuIDI7CiAgICB9CgogIGluLnNlZWtw KDApOyAvLyA8PDw8PDw8CgogIHdoaWxlKCAhaW4uZW9mKCkgKQogICAgewogICAgICBzdHJpbmcg czsKICAgICAgZ2V0bGluZSggaW4sIHMgKTsKICAgICAgY291dCA8PCBzIDw8IGVuZGw7OwogICAg fQogICAgCiAgcmV0dXJuIDA7Cn07Cg==