about summary refs log tree commit diff
path: root/stdio-common/test-popen.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/test-popen.c')
-rw-r--r--stdio-common/test-popen.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/stdio-common/test-popen.c b/stdio-common/test-popen.c
index 426da4a24c..b13a1c2542 100644
--- a/stdio-common/test-popen.c
+++ b/stdio-common/test-popen.c
@@ -82,6 +82,21 @@ main (void)
 
   remove ("/tmp/tstpopen.tmp");
 
+  errno = 0;
+  output = popen ("/bin/cat", "m");
+  if (output != NULL)
+    {
+      puts ("popen called with illegal mode does not return NULL");
+      puts ("Test FAILED!");
+      exit (1);
+    }
+  if (errno != EINVAL)
+    {
+      puts ("popen called with illegal mode does not set errno to EINVAL");
+      puts ("Test FAILED!");
+      exit (1);
+    }
+
   puts (wstatus | rstatus  ? "Test FAILED!" : "Test succeeded.");
   exit (wstatus | rstatus);
 }