about summary refs log tree commit diff
path: root/posix/tst-dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/tst-dir.c')
-rw-r--r--posix/tst-dir.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/posix/tst-dir.c b/posix/tst-dir.c
index 1eff3b5e06..74948af140 100644
--- a/posix/tst-dir.c
+++ b/posix/tst-dir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
 
@@ -518,6 +518,32 @@ main (int argc, char *argv[])
       result = 1;
     }
 
+  /* One more test before we leave: mkdir() is supposed to fail with
+     EEXIST if the named file is a symlink.  */
+  if (symlink ("a-symlink", "a-symlink") != 0)
+    {
+      printf ("cannot create symlink \"a-symlink\": %m\n");
+      result = 1;
+    }
+  else
+    {
+      if (mkdir ("a-symlink", 0666) == 0)
+	{
+	  puts ("can make directory \"a-symlink\"");
+	  result = 1;
+	}
+      else if (errno != EEXIST)
+	{
+	  puts ("mkdir(\"a-symlink\") does not fail with EEXIST\n");
+	  result = 1;
+	}
+      if (unlink ("a-symlink") < 0)
+	{
+	  printf ("cannot unlink \"a-symlink\": %m\n");
+	  result = 1;
+	}
+    }
+
   if (chdir (srcdir) < 0)
     {
       printf ("cannot change back to source directory: %m\n");