aboutsummaryrefslogtreecommitdiff
path: root/gas/input-file.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-01-12 03:14:01 +0000
committerAlan Modra <amodra@gmail.com>2007-01-12 03:14:01 +0000
commit1f5409bb9c1b98fc69b351b38594f5cbc9d731ca (patch)
treef8054148efc4c743ab309bf0ff5735557e4629f9 /gas/input-file.c
parent7bd7b3eff2840d8309852c8a4091cb3b589fccd8 (diff)
downloadgdb-1f5409bb9c1b98fc69b351b38594f5cbc9d731ca.zip
gdb-1f5409bb9c1b98fc69b351b38594f5cbc9d731ca.tar.gz
gdb-1f5409bb9c1b98fc69b351b38594f5cbc9d731ca.tar.bz2
* input-file.c (input_file_open): Check fgets return.
Diffstat (limited to 'gas/input-file.c')
-rw-r--r--gas/input-file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gas/input-file.c b/gas/input-file.c
index 91ec530..0907bad 100644
--- a/gas/input-file.c
+++ b/gas/input-file.c
@@ -163,8 +163,8 @@ input_file_open (char *filename, /* "" means use stdin. Must not be 0. */
c = getc (f_in);
if (c == 'N')
{
- fgets (buf, 80, f_in);
- if (!strncmp (buf, "O_APP", 5) && ISSPACE (buf[5]))
+ if (fgets (buf, sizeof (buf), f_in)
+ && !strncmp (buf, "O_APP", 5) && ISSPACE (buf[5]))
preprocess = 0;
if (!strchr (buf, '\n'))
ungetc ('#', f_in); /* It was longer. */
@@ -173,8 +173,8 @@ input_file_open (char *filename, /* "" means use stdin. Must not be 0. */
}
else if (c == 'A')
{
- fgets (buf, 80, f_in);
- if (!strncmp (buf, "PP", 2) && ISSPACE (buf[2]))
+ if (fgets (buf, sizeof (buf), f_in)
+ && !strncmp (buf, "PP", 2) && ISSPACE (buf[2]))
preprocess = 1;
if (!strchr (buf, '\n'))
ungetc ('#', f_in);