Blob Blame History Raw
From roland@redhat.com Sun Aug 12 15:45:49 2007
Date: Sun, 12 Aug 2007 05:45:16 -0700 (PDT)
From: Roland McGrath <roland@redhat.com>
To: Panu Matilainen <pmatilai@redhat.com>
Cc: Paul Nasrat <pnasrat@redhat.com>
Subject: Re: debugedit.c goof

> No need, already applied upstream HEAD, 4.4.x branch and rawhide build 
> with the fix triggered.

Too quick!  I have another fix. ;-)

This one is less trivial, and not tested.  It should make it put names in
the -l file when they match the edit replace directory name as well as the
edit match directory name, the point being that it emits the same names
when run twice in a row.

Thanks,
Roland


diff -r fb1ee4c438c9 tools/debugedit.c
--- a/tools/debugedit.c	Sun Aug 12 15:27:46 2007 +0300
+++ b/tools/debugedit.c	Sun Aug 12 05:42:13 2007 -0700
@@ -567,23 +567,22 @@ edit_dwarf2_line (DSO *dso, uint_32 off,
 	  memcpy (s + comp_dir_len + 1 + dir_len + 1, file, file_len + 1);
 	}
       canonicalize_path (s, s);
-      if (base_dir == NULL ||
-	  has_prefix (s, base_dir))
-	{
-	  char *p;
-	  size_t size;
-	  ssize_t ret;
-	  if (base_dir)
+      if (list_file_fd != -1)
+	{
+	  char *p = NULL;
+	  if (base_dir == NULL)
+	    p = s;
+	  else if (has_prefix (s, base_dir))
 	    p = s + strlen (base_dir);
-	  else
-	    p = s;
-	  
-	  if (list_file_fd != -1)
+	  else if (has_prefix (s, dest_dir))
+	    p = s + strlen (dest_dir);
+
+	  if (p)
 	    {
-	      size = strlen (p) + 1;
+	      size_t size = strlen (p) + 1;
 	      while (size > 0)
 		{
-		  ret = write (list_file_fd, p, size);
+		  ssize_t ret = write (list_file_fd, p, size);
 		  if (ret == -1)
 		    break;
 		  size -= ret;