changeset 8283:32427329c42c

(PTY_TTY_NAME_SPRINTF): Fail smoothly if cannot get pty.
author Richard M. Stallman <rms@gnu.org>
date Tue, 19 Jul 1994 16:11:28 +0000
parents 206451cdd48a
children f21e11ac80bb
files src/s/usg5-4.h
diffstat 1 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- 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)