Skip to content
Snippets Groups Projects
Commit 2e02f296 authored by Christos Zoulas's avatar Christos Zoulas Committed by Nick Clifton
Browse files

Tidy up ar_open by using asprintf to replace xmalloc and sprintf.

	PR 24649
	* arsup.c (ar_open): Use asprintf in place of xmalloc and
	sprintf.
parent a3972330
No related branches found
No related tags found
No related merge requests found
2019-06-10 Christos Zoulas <christos@zoulas.com>
PR 24649
* arsup.c (ar_open): Use asprintf in place of xmalloc and
sprintf.
2019-06-03 Nick Clifton <nickc@redhat.com>
Revert:
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment