dev.c patch

Alex Waugh alex at alexwaugh.com
Sun Dec 30 09:45:39 PST 2001


Hi

Opening a file with open(path, O_RDWR); does not return ENOENT when the
files does not exist. The following patch fixes this.

Index: unixlib/source/unix/dev.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/unix/dev.c,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 dev.c
--- unixlib/source/unix/dev.c	2001/12/18 11:20:13	1.2.2.3
+++ unixlib/source/unix/dev.c	2001/12/30 16:43:51
@@ -163,7 +163,7 @@
   else
     {
       /* No file exists.  */
-      if ((fflag & O_ACCMODE) == O_RDONLY && !(fflag & O_CREAT))
+      if (!(fflag & O_CREAT))
 	/* File doesn't exist and O_CREAT was not specified.  */
 	return (void *) __set_errno (ENOENT);
       /*if (fflag & O_ACCMODE)

Cheers

Alex

-- 
Alex Waugh                               alex at alexwaugh.com

PHP, Roots, WebJames and more from http://www.alexwaugh.com/



More information about the gcc mailing list