Work around a MacOS X 10.4 bug with openpty.
authorSimon Josefsson <simon@josefsson.org>
Sun, 25 Apr 2010 10:59:22 +0000 (12:59 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 25 Apr 2010 10:59:22 +0000 (12:59 +0200)
ChangeLog
doc/glibc-functions/openpty.texi
tests/test-openpty.c

index b115acd..3b85b02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-25  Simon Josefsson  <simon@josefsson.org>
+            Bruno Haible  <bruno@clisp.org>
+
+       Work around a MacOS X 10.4 bug with openpty.
+       * doc/glibc-functions/openpty.texi: Mention the MacOS X 10.4 bug.
+       * tests/test-openpty.c (main): Close the master side explicitly.
+
 2010-04-25  Bruno Haible  <bruno@clisp.org>
 
        strnlen: Fix a C++ test error on MacOS X and Solaris.
index 31fdca0..b9577d5 100644 (file)
@@ -30,4 +30,9 @@ Portability problems not fixed by Gnulib:
 @item
 This function is missing on some platforms:
 mingw.
+@item
+After a successful call to @code{openpty}, the application needs to close
+the master's file descriptor before closing the slave's file descriptor,
+otherwise the process may hang in a state where it cannot be killed, on
+some platforms: MacOS X 10.4.11.
 @end itemize
index 4012e16..41caaf2 100644 (file)
@@ -99,6 +99,10 @@ main ()
           return 1;
         }
     }
+
+    /* Close the master side before the slave side gets closed.
+       This is necessary on MacOS X 10.4.11.  */
+    close (master);
   }
 
   return 0;