Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [patch/rfc/testsuite] Fix read-only fileio test on GNU/Linux
Date: Mon, 05 Jan 2004 20:01:00 -0000	[thread overview]
Message-ID: <3FF9C291.1080104@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

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

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 760 bytes --]

2004-01-05  Andrew Cagney  <cagney@redhat.com>

	* 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);

             reply	other threads:[~2004-01-05 20:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-05 20:01 Andrew Cagney [this message]
2004-01-07 16:04 ` Andrew Cagney
2004-01-26 11:46 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FF9C291.1080104@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox