From: Richard M. Stallman Date: Tue, 19 Jul 1994 16:11:28 +0000 (+0000) Subject: (PTY_TTY_NAME_SPRINTF): Fail smoothly if cannot get pty. X-Git-Tag: emacs-19.34~7570 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5bf62b08d9b79fb909934d7e0640a5b517940735;p=emacs.git (PTY_TTY_NAME_SPRINTF): Fail smoothly if cannot get pty. --- diff --git a/src/s/usg5-4.h b/src/s/usg5-4.h index d60a5eb8524..f8e6ae9a695 100644 --- a/src/s/usg5-4.h +++ b/src/s/usg5-4.h @@ -131,7 +131,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define HAVE_WAIT_HEADER #define WAITTYPE int #define wait3(status, options, rusage) \ - waitpid((pid_t) -1, (status), (options)) + waitpid ((pid_t) -1, (status), (options)) #define WRETCODE(w) (w >> 8) /* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY @@ -155,20 +155,20 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ intercepting that death. If any child but grantpt's should die within, it should be caught after sigrelse(2). */ -#define PTY_TTY_NAME_SPRINTF \ - { \ - char *ptsname(), *ptyname; \ - \ - sighold(SIGCLD); \ - if (grantpt(fd) == -1) \ - fatal("could not grant slave pty"); \ - sigrelse(SIGCLD); \ - if (unlockpt(fd) == -1) \ - fatal("could not unlock slave pty"); \ - if (!(ptyname = ptsname(fd))) \ - fatal ("could not enable slave pty"); \ - strncpy(pty_name, ptyname, sizeof(pty_name)); \ - pty_name[sizeof(pty_name) - 1] = 0; \ +#define PTY_TTY_NAME_SPRINTF \ + { \ + char *ptsname (), *ptyname; \ + \ + sighold (SIGCLD); \ + if (grantpt (fd) == -1) \ + { close (fd); return -1; } \ + sigrelse (SIGCLD); \ + if (unlockpt (fd) == -1) \ + { close (fd); return -1; } \ + if (!(ptyname = ptsname (fd))) \ + { close (fd); return -1; } \ + strncpy (pty_name, ptyname, sizeof (pty_name)); \ + pty_name[sizeof (pty_name) - 1] = 0; \ } /* Push various streams modules onto a PTY channel. */ @@ -199,6 +199,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ So give it a try. */ #define HAVE_SOCKETS -#define bcopy(src,dst,n) memmove(dst,src,n) -#define bcmp(src,dst,n) memcmp(src,dst,n) -#define bzero(s,n) memset(s,0,n) +#define bcopy(src,dst,n) memmove (dst,src,n) +#define bcmp(src,dst,n) memcmp (src,dst,n) +#define bzero(s,n) memset (s,0,n)