mirror of
https://github.com/mirror/wget.git
synced 2025-03-31 06:30:12 +08:00
* src/utils.c (unique_name_1): Replace alloca by xmalloc
This commit is contained in:
parent
233f982f9d
commit
4dd9dee2e7
@ -659,7 +659,7 @@ unique_name_1 (const char *prefix)
|
|||||||
{
|
{
|
||||||
int count = 1;
|
int count = 1;
|
||||||
int plen = strlen (prefix);
|
int plen = strlen (prefix);
|
||||||
char *template = (char *)alloca (plen + 1 + 24);
|
char *template = xmalloc (plen + 1 + 24);
|
||||||
char *template_tail = template + plen;
|
char *template_tail = template + plen;
|
||||||
|
|
||||||
memcpy (template, prefix, plen);
|
memcpy (template, prefix, plen);
|
||||||
@ -667,9 +667,9 @@ unique_name_1 (const char *prefix)
|
|||||||
|
|
||||||
do
|
do
|
||||||
number_to_string (template_tail, count++);
|
number_to_string (template_tail, count++);
|
||||||
while (file_exists_p (template, NULL));
|
while (file_exists_p (template, NULL) && count < 999999);
|
||||||
|
|
||||||
return xstrdup (template);
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a unique file name, based on FILE.
|
/* Return a unique file name, based on FILE.
|
||||||
|
Loading…
Reference in New Issue
Block a user