summaryrefslogtreecommitdiff
path: root/binutils/arsup.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/arsup.c')
-rw-r--r--binutils/arsup.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/binutils/arsup.c b/binutils/arsup.c
index 0058c0d31f..1e86479395 100644
--- a/binutils/arsup.c
+++ b/binutils/arsup.c
@@ -160,10 +160,11 @@ DEFUN(ar_open,(name, t),
{
char *tname = (char *) xmalloc (strlen (name) + 10);
+ 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, "tmp-%s", name);
+ sprintf(tname, "%.*stmp-%s", (int) (bname - name), name, bname);
obfd = bfd_openw(tname, NULL);
if (!obfd) {