Author: jonpryor
Date: 2007-06-29 07:28:25 -0400 (Fri, 29 Jun 2007)
New Revision: 81037

Modified:
   trunk/mono/support/ChangeLog
   trunk/mono/support/dirent.c
   trunk/mono/support/grp.c
   trunk/mono/support/pwd.c
   trunk/mono/support/stdio.c
   trunk/mono/support/syslog.c
   trunk/mono/support/unistd.c
Log:
        * dirent.c, grp.c, pwd.c, stdio.c, syslog.c, unistd.c: Following in the
          logic of the 2007-06-27 logic...  Only return failure if an actual
          DOCUMENTED error occurred.  For many of these functions, there are no
          docuemented errors, so they "can't fail," even if errno were set.
          All praise the POSIX standard?


Modified: trunk/mono/support/ChangeLog
===================================================================
--- trunk/mono/support/ChangeLog        2007-06-29 11:27:15 UTC (rev 81036)
+++ trunk/mono/support/ChangeLog        2007-06-29 11:28:25 UTC (rev 81037)
@@ -1,3 +1,11 @@
+2007-06-29  Jonathan Pryor  <[EMAIL PROTECTED]>
+
+       * dirent.c, grp.c, pwd.c, stdio.c, syslog.c, unistd.c: Following in the
+         logic of the 2007-06-27 logic...  Only return failure if an actual
+         DOCUMENTED error occurred.  For many of these functions, there are no
+         docuemented errors, so they "can't fail," even if errno were set.
+         All praise the POSIX standard?
+
 2007-06-28  Jonathan Pryor  <[EMAIL PROTECTED]>
 
        * map.c, map.h: Refresh -- to add Utimbuf copy conversion functions.

Modified: trunk/mono/support/dirent.c
===================================================================
--- trunk/mono/support/dirent.c 2007-06-29 11:27:15 UTC (rev 81036)
+++ trunk/mono/support/dirent.c 2007-06-29 11:28:25 UTC (rev 81037)
@@ -23,11 +23,9 @@
 {
        mph_return_if_off_t_overflow (offset);
 
-       errno = 0;
-
        seekdir ((DIR*) dir, (off_t) offset);
 
-       return errno != 0;
+       return 0;
 }
 
 mph_off_t
@@ -94,9 +92,8 @@
 int
 Mono_Posix_Syscall_rewinddir (void* dir)
 {
-       errno = 0;
        rewinddir (dir);
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 G_END_DECLS

Modified: trunk/mono/support/grp.c
===================================================================
--- trunk/mono/support/grp.c    2007-06-29 11:27:15 UTC (rev 81036)
+++ trunk/mono/support/grp.c    2007-06-29 11:28:25 UTC (rev 81037)
@@ -293,9 +293,8 @@
 int
 Mono_Posix_Syscall_endgrent (void)
 {
-       errno = 0;
        endgrent();
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 

Modified: trunk/mono/support/pwd.c
===================================================================
--- trunk/mono/support/pwd.c    2007-06-29 11:27:15 UTC (rev 81036)
+++ trunk/mono/support/pwd.c    2007-06-29 11:28:25 UTC (rev 81037)
@@ -249,7 +249,9 @@
 {
        errno = 0;
        endpwent ();
-       return errno == 0 ? 0 : -1;
+       if (errno == EIO)
+               return -1;
+       return 0;
 }
 
 G_END_DECLS

Modified: trunk/mono/support/stdio.c
===================================================================
--- trunk/mono/support/stdio.c  2007-06-29 11:27:15 UTC (rev 81036)
+++ trunk/mono/support/stdio.c  2007-06-29 11:28:25 UTC (rev 81037)
@@ -148,9 +148,8 @@
 int 
 Mono_Posix_Stdlib_setbuf (void* stream, void* buf)
 {
-       errno = 0;
        setbuf (stream, buf);
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 gint32
@@ -189,25 +188,26 @@
 int
 Mono_Posix_Stdlib_rewind (void* stream)
 {
-       errno = 0;
-       rewind (stream);
-       return errno == 0 ? 0 : -1;
+       do {
+               rewind (stream);
+       } while (errno == EINTR);
+       mph_return_if_val_in_list5(errno, EAGAIN, EBADF, EFBIG, EINVAL, EIO);
+       mph_return_if_val_in_list5(errno, ENOSPC, ENXIO, EOVERFLOW, EPIPE, 
ESPIPE);
+       return 0;
 }
 
 int
 Mono_Posix_Stdlib_clearerr (void* stream)
 {
-       errno = 0;
        clearerr (((FILE*) stream));
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 int
 Mono_Posix_Stdlib_perror (const char* s)
 {
-       errno = 0;
        perror (s);
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 #define MPH_FPOS_LENGTH (sizeof(fpos_t)*2)

Modified: trunk/mono/support/syslog.c
===================================================================
--- trunk/mono/support/syslog.c 2007-06-29 11:27:15 UTC (rev 81036)
+++ trunk/mono/support/syslog.c 2007-06-29 11:28:25 UTC (rev 81037)
@@ -20,25 +20,22 @@
 int
 Mono_Posix_Syscall_openlog (void* ident, int option, int facility)
 {
-       errno = 0;
        openlog ((const char*) ident, option, facility);
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 int
 Mono_Posix_Syscall_closelog (void)
 {
-       errno = 0;
        closelog ();
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 int
 Mono_Posix_Syscall_syslog (int priority, const char* message)
 {
-       errno = 0;
        syslog (priority, message);
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 /* vararg version of syslog(3). */
@@ -47,14 +44,10 @@
 {
        va_list ap;
 
-       errno = 0;
-
        va_start (ap, format);
        vsyslog (priority, format, ap);
        va_end (ap);
 
-       if (errno != 0)
-               return -1;
        return 0;
 }
 

Modified: trunk/mono/support/unistd.c
===================================================================
--- trunk/mono/support/unistd.c 2007-06-29 11:27:15 UTC (rev 81036)
+++ trunk/mono/support/unistd.c 2007-06-29 11:28:25 UTC (rev 81037)
@@ -239,25 +239,22 @@
 int
 Mono_Posix_Syscall_setusershell (void)
 {
-       errno = 0;
        setusershell ();
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 int
 Mono_Posix_Syscall_endusershell (void)
 {
-       errno = 0;
        endusershell ();
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 int
 Mono_Posix_Syscall_sync (void)
 {
-       errno = 0;
        sync ();
-       return errno == 0 ? 0 : -1;
+       return 0;
 }
 
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to