This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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] fix spu open setting of "mode" argument


Jeff - can you please apply?

The wrong flag is being checked to determine if "mode" should be used or
not in spu open (O_CREAT is used when but we should reference
JSRE_O_CREAT).

Just unconditionally set the mode.

libgloss/ChangeLog:

2007-05-07 Patrick Mansfield <patmans@us.ibm.com>

	* spu/open.c: Unconditionally set the "mode" to fix a bug where
	mode was not properly set.

Index: my-base-quilt/libgloss/spu/open.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/open.c
+++ my-base-quilt/libgloss/spu/open.c
@@ -39,6 +39,7 @@ open (const char *filename, int flags, .
 {
         syscall_open_t sys ;
 	syscall_out_t	*psys_out = ( syscall_out_t* )&sys;
+        va_list ap;
 
         sys.pathname = ( unsigned int )filename;
 
@@ -63,22 +64,11 @@ open (const char *filename, int flags, .
 	sys.flags |= ( ( flags & O_WRONLY ) ? JSRE_O_WRONLY : 0 );
 	sys.flags |= ( ( flags & O_RDWR )  ? JSRE_O_RDWR  : 0 );
 
-
 	/* FIXME: we have to check/map all flags */
 
-        if ((sys.flags & O_CREAT))
-          {
-                  va_list ap;
-
-                  va_start (ap, flags);
-                  sys.mode = va_arg (ap, int);
-                  va_end (ap);
-
-          }
-        else
-          {
-                  sys.mode = 0;
-          }
+        va_start (ap, flags);
+        sys.mode = va_arg (ap, int);
+        va_end (ap);
 
         __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_OPEN, &sys);
 


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