From: Karl Heuer Date: Mon, 17 Jul 1995 22:27:13 +0000 (+0000) Subject: (sys_close): Handle Sunos 4.1 bug in close errno value. X-Git-Tag: emacs-19.34~3312 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fe111dafb1c787e2de38fbd8c695954d557e3272;p=emacs.git (sys_close): Handle Sunos 4.1 bug in close errno value. (init_system_name): Add cast in init for fqdn. --- diff --git a/src/sysdep.c b/src/sysdep.c index be412e2385d..8b77362b98f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2170,7 +2170,7 @@ init_system_name () } if (hp) { - char *fqdn = hp->h_name; + char *fqdn = (char *) hp->h_name; char *p; if (!index (fqdn, '.')) @@ -2884,10 +2884,19 @@ sys_open (path, oflag, mode) 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; }