about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/tst-environ.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/stdlib/tst-environ.c b/stdlib/tst-environ.c
index 4d17634b52..f728ce5890 100644
--- a/stdlib/tst-environ.c
+++ b/stdlib/tst-environ.c
@@ -138,5 +138,21 @@ main (void)
       result = 1;
     }
 
+  /* Now a test with an environment variable that's one character long.
+     This is to test a special case in the getenv implementation.  */
+  strcpy (putenv_val, "X=one character test");
+  if (putenv (putenv_val) != 0)
+    {
+      printf ("putenv #2 failed: %m\n");
+      result = 1;
+    }
+
+  valp = getenv ("X");
+  if (valp == NULL || strcmp (valp, "one character test") != 0)
+    {
+      puts ("getenv #11 failed");
+      result = 1;
+    }
+
   return result;
 }