2002-03-25 Jeff Law (law@redhat.com)
[deliverable/binutils-gdb.git] / gdb / linux-proc.c
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.031833 seconds and 4 git commands to generate.