2002-03-25 Jeff Law (law@redhat.com)
authorMichael Snyder <msnyder@vmware.com>
Mon, 25 Mar 2002 19:47:41 +0000 (19:47 +0000)
committerMichael Snyder <msnyder@vmware.com>
Mon, 25 Mar 2002 19:47:41 +0000 (19:47 +0000)
* linux-proc.c (read_mapping): Scan up to end of line for filename.

gdb/ChangeLog
gdb/linux-proc.c

index 948ecc99d4798afe1f94ea533f0c262af459419d..0500e9475ca38bbb8da99c19383b124202fcd749 100644 (file)
@@ -1,3 +1,7 @@
+2002-03-25  Jeff Law (law@redhat.com)
+
+       * linux-proc.c (read_mapping): Scan up to end of line for filename.
+
 2002-03-25  Michal Ludvig  <mludvig@suse.cz>
 
        * x86-64-tdep.c (x86_64_skip_prologue): Rewritten from scratch.
index d6f88d33ce0a5fa2e2a58b79e6e15406fc27aeb4..832f14eb91f88dfc8010c58c71f7cc4ee79ba2ee 100644 (file)
@@ -77,7 +77,14 @@ read_mapping (FILE *mapfile,
 
   if (ret > 0 && ret != EOF && *inode != 0)
     {
-      ret += fscanf (mapfile, "%s\n", filename);
+      /* Eat everything up to EOL for the filename.  This will prevent
+       weird filenames (such as one with embedded whitespace) from
+       confusing this code.  It also makes this code more robust
+       in respect to annotations the kernel may add after the
+       filename.
+
+       Note the filename is used for informational purposes only.  */
+      ret += fscanf (mapfile, "%[^\n]\n", filename);
     }
   else
     {
This page took 0.027267 seconds and 4 git commands to generate.