changeset 12547:63cdecbd7af4

(sys_close): Handle Sunos 4.1 bug in close errno value. (init_system_name): Add cast in init for fqdn.
author Karl Heuer <kwzh@gnu.org>
date Mon, 17 Jul 1995 22:27:13 +0000
parents f4fb791df099
children 531c4c566e55
files src/sysdep.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Mon Jul 17 22:25:39 1995 +0000
+++ b/src/sysdep.c	Mon Jul 17 22:27:13 1995 +0000
@@ -2170,7 +2170,7 @@
 	}
       if (hp)
 	{
-	  char *fqdn = hp->h_name;
+	  char *fqdn = (char *) hp->h_name;
 	  char *p;
 
 	  if (!index (fqdn, '.'))
@@ -2884,10 +2884,19 @@
 sys_close (fd)
      int fd;
 {
+  int did_retry = 0;
   register int rtnval;
 
   while ((rtnval = close (fd)) == -1
-	 && (errno == EINTR));
+	 && (errno == EINTR))
+    did_retry = 1;
+
+  /* If close is interrupted SunOS 4.1 may or may not have closed the
+     file descriptor.  If it did the second close will fail with
+     errno = EBADF.  That means we have succeeded.  */
+  if (rtnval == -1 && did_retry && errno == EBADF)
+    return 0;
+
   return rtnval;
 }