aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/linux-proc.c')
-rw-r--r--gdb/linux-proc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c
index d6f88d3..832f14e 100644
--- a/gdb/linux-proc.c
+++ b/gdb/linux-proc.c
@@ -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
{