This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/rfc/testsuite] Fix read-only fileio test on GNU/Linux


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]