From: Ulrich Drepper Date: Fri, 1 Oct 2004 15:44:06 +0000 (+0000) Subject: Update. X-Git-Tag: cvs/fedora-glibc-20041001T2134~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb984ef2a284a17e67b9143f4a432df719191004;p=thirdparty%2Fglibc.git Update. 2004-10-01 Ulrich Drepper * posix/bug-glob1.c (prepare): Fix creation of symlink. --- diff --git a/ChangeLog b/ChangeLog index 39662680d9e..8a4067d481d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-10-01 Ulrich Drepper + + * posix/bug-glob1.c (prepare): Fix creation of symlink. + 2004-09-30 Ulrich Drepper * posix/Makefile: Add rules to build and run bug-glob1. diff --git a/posix/bug-glob1.c b/posix/bug-glob1.c index 4f7e981c75b..05c2da7584f 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); }