diff options
author | Alan Modra <amodra@gmail.com> | 2006-09-12 23:57:26 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2006-09-12 23:57:26 +0000 |
commit | f79d9c1df706aef4088cddd39a41c1f0c3ea64f3 (patch) | |
tree | 84abd750a186f1e2a3de870179c88bc75707f34d | |
parent | 41198d0cfa94b0197dc8bdfb9542ad55ce980850 (diff) | |
download | gdb-f79d9c1df706aef4088cddd39a41c1f0c3ea64f3.zip gdb-f79d9c1df706aef4088cddd39a41c1f0c3ea64f3.tar.gz gdb-f79d9c1df706aef4088cddd39a41c1f0c3ea64f3.tar.bz2 |
* input-file.c (input_file_open): Replace as_perror with as_bad
so that gas exits with error on file errors. Correct error
message.
(input_file_get, input_file_give_next_buffer): Likewise.
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/input-file.c | 20 | ||||
-rw-r--r-- | gas/input-file.h | 7 |
3 files changed, 19 insertions, 15 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index b69fa82..3139cbf 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2006-09-13 Alan Modra <amodra@bigpond.net.au> + + * input-file.c (input_file_open): Replace as_perror with as_bad + so that gas exits with error on file errors. Correct error + message. + (input_file_get, input_file_give_next_buffer): Likewise. + 2006-09-11 Tomas Frydrych <dr.tomas@yahoo.co.uk> PR gas/3172 diff --git a/gas/input-file.c b/gas/input-file.c index 6ebd6b9..ec36a42 100644 --- a/gas/input-file.c +++ b/gas/input-file.c @@ -140,8 +140,8 @@ input_file_open (char *filename, /* "" means use stdin. Must not be 0. */ if (f_in == NULL) { - bfd_set_error (bfd_error_system_call); - as_perror (_("Can't open %s for reading"), file_name); + as_bad (_("can't open %s for reading: %s"), + file_name, xstrerror (errno)); return; } @@ -149,8 +149,8 @@ input_file_open (char *filename, /* "" means use stdin. Must not be 0. */ if (ferror (f_in)) { - bfd_set_error (bfd_error_system_call); - as_perror (_("Can't open %s for reading"), file_name); + as_bad (_("can't read from %s: %s"), + file_name, xstrerror (errno)); fclose (f_in); f_in = NULL; @@ -212,8 +212,7 @@ input_file_get (char *buf, int buflen) size = fread (buf, sizeof (char), buflen, f_in); if (size < 0) { - bfd_set_error (bfd_error_system_call); - as_perror (_("Can't read from %s"), file_name); + as_bad (_("can't read from %s: %s"), file_name, xstrerror (errno)); size = 0; } return size; @@ -239,8 +238,7 @@ input_file_give_next_buffer (char *where /* Where to place 1st character of new size = fread (where, sizeof (char), BUFFER_SIZE, f_in); if (size < 0) { - bfd_set_error (bfd_error_system_call); - as_perror (_("Can't read from %s"), file_name); + as_bad (_("can't read from %s: %s"), file_name, xstrerror (errno)); size = 0; } if (size) @@ -248,10 +246,8 @@ input_file_give_next_buffer (char *where /* Where to place 1st character of new else { if (fclose (f_in)) - { - bfd_set_error (bfd_error_system_call); - as_perror (_("Can't close %s"), file_name); - } + as_bad (_("can't close %s: %s"), file_name, xstrerror (errno)); + f_in = (FILE *) 0; return_value = 0; } diff --git a/gas/input-file.h b/gas/input-file.h index bc8289e..0628716 100644 --- a/gas/input-file.h +++ b/gas/input-file.h @@ -1,5 +1,6 @@ /* input_file.h header for input-file.c - Copyright 1987, 1992, 1993, 2000, 2003 Free Software Foundation, Inc. + Copyright 1987, 1992, 1993, 2000, 2003, 2005, 2006 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -51,8 +52,8 @@ * * input_file_close () Closes opened file. * - * All errors are reported (using as_perror) so caller doesn't have to think - * about I/O errors. No I/O errors are fatal: an end-of-file may be faked. + * All errors are reported so caller doesn't have to think + * about I/O errors. */ char *input_file_give_next_buffer (char *where); |