summary refs log tree commit diff
path: root/posix/bug-glob1.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-01 21:37:29 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-01 21:37:29 +0000
commit6d96590587deec027c04fe576f11cff0f445eb32 (patch)
treea0b964a672b5e970d88a8f030da837ce14885aae /posix/bug-glob1.c
parentb7a09b9201b09b722209cb430813709505927be0 (diff)
downloadglibc-6d96590587deec027c04fe576f11cff0f445eb32.tar.gz
glibc-6d96590587deec027c04fe576f11cff0f445eb32.tar.xz
glibc-6d96590587deec027c04fe576f11cff0f445eb32.zip
Updated to fedora-glibc-20041001T2134 cvs/fedora-glibc-2_3_3-63
Diffstat (limited to 'posix/bug-glob1.c')
-rw-r--r--posix/bug-glob1.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/posix/bug-glob1.c b/posix/bug-glob1.c
index 4f7e981c75..05c2da7584 100644
--- a/posix/bug-glob1.c
+++ b/posix/bug-glob1.c
@@ -26,15 +26,21 @@ prepare (int argc, char *argv[])
 
   size_t len = strlen (argv[1]);
   static const char ext[] = "globXXXXXX";
-  fname = malloc (len + 1 + sizeof (ext));
+  fname = malloc (len + sizeof (ext));
   if (fname == NULL)
     error (EXIT_FAILURE, errno, "cannot create temp file");
-  strcpy (stpcpy (stpcpy (fname, argv[1]), "/"), ext);
+ again:
+  strcpy (stpcpy (fname, argv[1]), ext);
   fname = mktemp (fname);
   if (fname == NULL || *fname == '\0')
     error (EXIT_FAILURE, errno, "cannot create temp file name");
   if (symlink ("bug-glob1-does-not-exist", fname) != 0)
-    error (EXIT_FAILURE, errno, "cannot create symlink");
+    {
+      if (errno == EEXIST)
+	goto again;
+
+      error (EXIT_FAILURE, errno, "cannot create symlink");
+    }
   add_temp_file (fname);
 }