Fix test-closein on Solaris 10.
authorEric Blake <ebb9@byu.net>
Fri, 28 Sep 2007 12:33:50 +0000 (06:33 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 28 Sep 2007 12:37:32 +0000 (06:37 -0600)
* tests/test-closein.c (main): Don't assume stdin can be inherited
closed on all systems.
* tests/test-closein.sh: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
tests/test-closein.c
tests/test-closein.sh

index 292c730750d6697694a4d6f27eeb30b730fdcb73..ebf8ef33f15d9ad2bbb00aa0bc9abfa095f58734 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-28  Eric Blake  <ebb9@byu.net>
+
+       Fix test-closein on Solaris 10.
+       * tests/test-closein.c (main): Don't assume stdin can be inherited
+       closed on all systems.
+       * tests/test-closein.sh: Likewise.
+
 2007-09-28  Jim Meyering  <jim@meyering.net>
 
        * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Fix typo in comment.
index 90214e8e253507a8a2771620eba85f3a5e636073..cf7b30a4c8101c665c6a94a554540a55e081fb44 100644 (file)
@@ -3,7 +3,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -23,6 +23,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "binary-io.h"
 
@@ -43,6 +44,9 @@ main (int argc, char **argv)
      unreliable on text mode input.  */
   SET_BINARY (0);
 
+  if (argc > 2)
+    close (0);
+
   if (argc > 1)
     i = fread (buf, 1, 6, stdin);
   return 0;
index 8623ead89771df23f60c8b30f23125d6e13369d4..4f5751176e0df756c519dfc72e0bd38f1aef1dcb 100755 (executable)
@@ -30,7 +30,7 @@ cat ${p}in.tmp | ./test-closein${EXEEXT} consume || exit 1
 ./test-closein${EXEEXT} consume </dev/null || exit 1
 
 # Test for error when read fails because no file available
-./test-closein${EXEEXT} consume <&- 2>/dev/null && exit 1
+./test-closein${EXEEXT} consume close <&- 2>/dev/null && exit 1
 
 # Cleanup
 rm -fr $tmpfiles