use asprintf(3)
This commit is contained in:
parent
4ff2b0009a
commit
6ca7fac253
11
external/gpl3/binutils/dist/binutils/arsup.c
vendored
11
external/gpl3/binutils/dist/binutils/arsup.c
vendored
@ -149,13 +149,20 @@ maybequit (void)
|
||||
void
|
||||
ar_open (char *name, int t)
|
||||
{
|
||||
char *tname = (char *) xmalloc (strlen (name) + 10);
|
||||
char *tname;
|
||||
const char *bname = lbasename (name);
|
||||
real_name = name;
|
||||
|
||||
/* Prepend tmp- to the beginning, to avoid file-name clashes after
|
||||
truncation on filesystems with limited namespaces (DOS). */
|
||||
sprintf (tname, "%.*stmp-%s", (int) (bname - name), name, bname);
|
||||
if (asprintf (&tname, "%.*stmp-%s", (int) (bname - name), name, bname) == -1)
|
||||
{
|
||||
fprintf (stderr, _("%s: Can't allocate memory for temp name (%s)\n"),
|
||||
program_name, strerror(errno));
|
||||
maybequit ();
|
||||
return;
|
||||
}
|
||||
|
||||
obfd = bfd_openw (tname, NULL);
|
||||
|
||||
if (!obfd)
|
||||
|
Loading…
Reference in New Issue
Block a user