hppa: Fix feupdateenv and fesetexceptflag (Bug 18111).
[glibc.git] / libio / tst-popen1.c
blobbae6615b9bcbf1b93b041f42164376d4c603ac5d
1 #include <fcntl.h>
2 #include <stdio.h>
4 static int
5 do_test (void)
7 int res = 0;
9 FILE *fp = popen ("echo hello", "r");
10 if (fp == NULL)
12 puts ("first popen failed");
13 res = 1;
15 else
17 int fd = fileno (fp);
18 if (fcntl (fd, F_GETFD) == FD_CLOEXEC)
20 puts ("first popen(\"r\") set FD_CLOEXEC");
21 res = 1;
24 fclose (fp);
27 fp = popen ("echo hello", "re");
28 if (fp == NULL)
30 puts ("second popen failed");
31 res = 1;
33 else
35 int fd = fileno (fp);
36 if (fcntl (fd, F_GETFD) != FD_CLOEXEC)
38 puts ("second popen(\"r\") did not set FD_CLOEXEC");
39 res = 1;
42 fclose (fp);
45 return res;
48 #define TEST_FUNCTION do_test ()
49 #include "../test-skeleton.c"