# HG changeset patch # User Richard M. Stallman # Date 774634288 0 # Node ID 32427329c42cacde4c79eccb1ad9bb1e44b3e98c # Parent 206451cdd48a616ab87ebd30b8709ced0d6debd5 (PTY_TTY_NAME_SPRINTF): Fail smoothly if cannot get pty. diff -r 206451cdd48a -r 32427329c42c src/s/usg5-4.h --- a/src/s/usg5-4.h Tue Jul 19 04:41:50 1994 +0000 +++ b/src/s/usg5-4.h Tue Jul 19 16:11:28 1994 +0000 @@ -131,7 +131,7 @@ #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 @@ 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 @@ 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)