diff options
author | Alan Modra <amodra@gmail.com> | 2005-02-21 03:03:02 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-02-21 03:03:02 +0000 |
commit | ac4528d236f87f0ca5a76199a2455f12101ab7f9 (patch) | |
tree | 4ae59500990ebe3ffdf955588937662584ffd350 /gas/input-file.c | |
parent | 665435215e31fcec0a19777edb9e83b0baf69854 (diff) | |
download | binutils-gdb-ac4528d236f87f0ca5a76199a2455f12101ab7f9.tar.gz |
* input-file.c (input_file_open): Rearrange to avoid warning.
Diffstat (limited to 'gas/input-file.c')
-rw-r--r-- | gas/input-file.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/gas/input-file.c b/gas/input-file.c index 01cc669feff..8fb04f7bc93 100644 --- a/gas/input-file.c +++ b/gas/input-file.c @@ -1,5 +1,6 @@ /* input_file.c - Deal with Input Files - - Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2003 + Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, + 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -146,21 +147,26 @@ input_file_open (char *filename, /* "" means use stdin. Must not be 0. */ file_name = _("{standard input}"); } - if (f_in) - c = getc (f_in); + if (f_in == NULL) + { +#ifdef BFD_ASSEMBLER + bfd_set_error (bfd_error_system_call); +#endif + as_perror (_("Can't open %s for reading"), file_name); + return; + } + + c = getc (f_in); - if (f_in == NULL || ferror (f_in)) + if (ferror (f_in)) { #ifdef BFD_ASSEMBLER bfd_set_error (bfd_error_system_call); #endif as_perror (_("Can't open %s for reading"), file_name); - if (f_in) - { - fclose (f_in); - f_in = NULL; - } + fclose (f_in); + f_in = NULL; return; } |