diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-10-01 15:44:06 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-10-01 15:44:06 +0000 |
commit | cb984ef2a284a17e67b9143f4a432df719191004 (patch) | |
tree | 2a94785e23a2e82b23b1af6b50cb9ee380ec1b35 /posix | |
parent | 7b87aca68fbeb4678e8e49f6682af8413668877e (diff) | |
download | glibc-cb984ef2a284a17e67b9143f4a432df719191004.zip glibc-cb984ef2a284a17e67b9143f4a432df719191004.tar.gz glibc-cb984ef2a284a17e67b9143f4a432df719191004.tar.bz2 |
Update.
2004-10-01 Ulrich Drepper <drepper@redhat.com>
* posix/bug-glob1.c (prepare): Fix creation of symlink.
Diffstat (limited to 'posix')
-rw-r--r-- | posix/bug-glob1.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/posix/bug-glob1.c b/posix/bug-glob1.c index 4f7e981..05c2da7 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); } |