This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix ar -M


Hi!

echo -e 'CREATE /tmp/test.a\nSAVE' | ar -M
doesn't work, since it wants to create temporary file tmp-/tmp/test.a
which of course cannot be created.
To fix this, either we don't care what the temporary name exactly is
(as in the patch below), or we want /tmp/tmp-test.a be created
(in which case probably lbasename should be used, I can cook up a patch if
the patch below is inappropriate).

2001-10-18  Jakub Jelinek  <jakub@redhat.com>

	* arsup.c (ar_open): Use make_tempname.

--- binutils/arsup.c.jj	Mon Mar 26 19:44:29 2001
+++ binutils/arsup.c	Thu Oct 18 11:40:03 2001
@@ -159,11 +159,8 @@ DEFUN(ar_open,(name, t),
       int t)
 
 {
-  char *tname = (char *) xmalloc (strlen (name) + 10);
+  char *tname = make_tempname (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);
   obfd = bfd_openw(tname, NULL);
 
   if (!obfd) {

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]