]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - stdio-common/test-popen.c
[powerpc] No need to enter "Ignore Exceptions Mode"
[thirdparty/glibc.git] / stdio-common / test-popen.c
index 40f75c0a0d67c3570d7bf9618896945ff6021942..0ccd9e5d32b9a80046eb2ebca4fd236f1b14a07c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <stdio.h>
@@ -49,8 +49,8 @@ read_data (FILE *stream)
     }
 }
 
-int
-main (void)
+static int
+do_test (void)
 {
   FILE *output, *input;
   int wstatus, rstatus;
@@ -59,7 +59,7 @@ main (void)
      the perhaps incompatible new shared libraries.  */
   unsetenv ("LD_LIBRARY_PATH");
 
-  output = popen ("/bin/cat >/tmp/tstpopen.tmp", "w");
+  output = popen ("/bin/cat >" OBJPFX "tstpopen.tmp", "w");
   if (output == NULL)
     {
       perror ("popen");
@@ -69,10 +69,10 @@ main (void)
   write_data (output);
   wstatus = pclose (output);
   printf ("writing pclose returned %d\n", wstatus);
-  input = popen ("/bin/cat /tmp/tstpopen.tmp", "r");
+  input = popen ("/bin/cat " OBJPFX "tstpopen.tmp", "r");
   if (input == NULL)
     {
-      perror ("/tmp/tstpopen.tmp");
+      perror (OBJPFX "tstpopen.tmp");
       puts ("Test FAILED!");
       exit (1);
     }
@@ -80,7 +80,7 @@ main (void)
   rstatus = pclose (input);
   printf ("reading pclose returned %d\n", rstatus);
 
-  remove ("/tmp/tstpopen.tmp");
+  remove (OBJPFX "tstpopen.tmp");
 
   errno = 0;
   output = popen ("/bin/cat", "m");
@@ -100,3 +100,6 @@ main (void)
   puts (wstatus | rstatus  ? "Test FAILED!" : "Test succeeded.");
   return (wstatus | rstatus);
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"