]> git.eshelyaron.com Git - emacs.git/commitdiff
(PTY_TTY_NAME_SPRINTF): Fail smoothly if cannot get pty.
authorRichard M. Stallman <rms@gnu.org>
Tue, 19 Jul 1994 16:11:28 +0000 (16:11 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 19 Jul 1994 16:11:28 +0000 (16:11 +0000)
src/s/usg5-4.h

index d60a5eb8524b72d1f74fb7a50180b8a543f6887c..f8e6ae9a6958b5ec163239bad15cc4adc4975ddb 100644 (file)
@@ -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)