changeset 18035:674bd7704497

fix pty related tests issues on Windows * lib/grantpt.c (grantpt): grantpt.c seems to be never used on Windows, however it's still present in tests/ subdirectory of the final project. Therefore avoid it to pass `make check`. * tests/test-openpty.c (main): Windows has no PTYs and gnulib's openpty() will just return -ENOSYS, so avoid this non applicable test allowing the build to proceed.
author Pavel Fedin <p.fedin@samsung.com>
date Wed, 01 Jul 2015 10:18:11 +0300
parents dce9e4637294
children b3833d5cf7e0
files ChangeLog lib/grantpt.c tests/test-openpty.c
diffstat 3 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-07-01  Pavel Fedin  <p.fedin@samsung.com>
+
+	fix pty related tests issues on Windows (trivial)
+	* lib/grantpt.c (grantpt): grantpt.c seems to be never used on Windows,
+	however it's still present in tests/ subdirectory of the final project.
+	Therefore avoid it to pass `make check`.
+	* tests/test-openpty.c (main): Windows has no PTYs and gnulib's openpty()
+	will just return -ENOSYS, so avoid this non applicable test allowing
+	the build to proceed.
+
 2015-07-01  Pádraig Brady  <P@draigBrady.com>
 
 	acl: fix definition of acl_from_mode on FreeBSD
--- a/lib/grantpt.c
+++ b/lib/grantpt.c
@@ -46,9 +46,10 @@
 int
 grantpt (int fd)
 {
-#if defined __OpenBSD__
+#if defined __OpenBSD__ || defined _WIN32
   /* On OpenBSD, master and slave of a pseudo-terminal are allocated together,
-     through an ioctl on /dev/ptm.  There is no need for grantpt().  */
+     through an ioctl on /dev/ptm.  On Windows there are no ptys.
+     Therefore in either case there is no need for grantpt().  */
   return 0;
 #else
   /* This function is most often called from a process without 'root'
--- a/tests/test-openpty.c
+++ b/tests/test-openpty.c
@@ -34,6 +34,7 @@
 main ()
 {
   {
+#ifndef _WIN32
     int master;
     int slave;
 
@@ -103,6 +104,7 @@
     /* Close the master side before the slave side gets closed.
        This is necessary on Mac OS X 10.4.11.  */
     close (master);
+#endif
   }
 
   return 0;