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: (Revised) ar -M temporary file bug


DJ Delorie wrote:
> The lbasename() function should be used in your patch.  It does what
> you want already.

I've revised the patch to use lbasename().

Earl
========================================================================
For binutils/ChangeLog:

        * arsup.h (ar_open): Create temporary filename by prepending
        tmp- to the basename, rather than the entire pathname.
        * arlex.l: Extend FILENAME definition to allow for DOS path
        separators.

--- arsup.c.orig	Sun May 28 03:57:50 2000
+++ arsup.c	Fri Oct 19 12:24:28 2001
@@ -160,10 +160,11 @@
 
 {
   char *tname = (char *) xmalloc (strlen (name) + 10);
+  char *basename = lbasename (name);
   real_name = name;
-  /* Prepend tmp- to the beginning, to avoid file-name clashes after
+  /* Prepend tmp- to the beginning of the file name, to avoid clashes
after
      truncation on filesystems with limited namespaces (DOS).  */
-  sprintf(tname, "tmp-%s", name);
+  sprintf(tname, "%.*stmp-%s", basename-name, name, basename);
   obfd = bfd_openw(tname, NULL);
 
   if (!obfd) {

--- arlex.l.orig	Tue May 23 00:57:58 2000
+++ arlex.l	Fri Oct 19 11:20:53 2001
@@ -71,7 +71,7 @@
 "("             { return '('; }
 ")"             { return ')'; }
 ","             { return ','; }
-[A-Za-z0-9/$:.\-\_]+  { 	
+[A-Za-z0-9/\\$:.\-\_]+  { 	
 		yylval.name =  xstrdup (yytext);
 		return FILENAME;
 		}


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