From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17110 invoked by alias); 5 Jan 2004 20:01:26 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17103 invoked from network); 5 Jan 2004 20:01:25 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 5 Jan 2004 20:01:25 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 7603B2B8F for ; Mon, 5 Jan 2004 15:01:21 -0500 (EST) Message-ID: <3FF9C291.1080104@redhat.com> Date: Mon, 05 Jan 2004 20:01:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [patch/rfc/testsuite] Fix read-only fileio test on GNU/Linux Content-Type: multipart/mixed; boundary="------------030407060704030209020700" X-SW-Source: 2004-01/txt/msg00101.txt.bz2 This is a multi-part message in MIME format. --------------030407060704030209020700 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 362 Hello, I think this deserves a "how did this ever work" award :-) The file was being created writeable (the S_IWUSR flag passed to open()) so little wonder GNU/Linux allowed an open-write (causing the test to fail) and who knows how/who this worked on BSD and remote systems. Tested on BSD and GNU/Linux. Baring comment I'll commit in a day or so. Andrew --------------030407060704030209020700 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 760 2004-01-05 Andrew Cagney * gdb.base/fileio.c (test_open): Do not pass S_IWUSR to "open" when creating the read-only file. From analysis by Roland McGrath and Elena Zannoni. Index: gdb.base/fileio.c =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/fileio.c,v retrieving revision 1.4 diff -u -r1.4 fileio.c --- gdb.base/fileio.c 2 Jan 2004 22:53:12 -0000 1.4 +++ gdb.base/fileio.c 5 Jan 2004 19:52:39 -0000 @@ -103,7 +103,7 @@ close (ret); /* Open for write but no write permission */ errno = 0; - ret = open (NOWRITE, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR); + ret = open (NOWRITE, O_CREAT | O_RDONLY, S_IRUSR); if (ret >= 0) { close (ret); --------------030407060704030209020700--