diff options
author | Nick Clifton <nickc@redhat.com> | 2003-12-19 15:23:41 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2003-12-19 15:23:41 +0000 |
commit | 5a1964ecbd3d7a66c626e2bb5edd7780b99f5aa9 (patch) | |
tree | d74dd9613386288ff8eb98abd1c5b449c20b30de /gas/input-file.c | |
parent | 10ecffb9b24b79b6a9f373d0c9df0f4c447864a5 (diff) | |
download | gdb-5a1964ecbd3d7a66c626e2bb5edd7780b99f5aa9.zip gdb-5a1964ecbd3d7a66c626e2bb5edd7780b99f5aa9.tar.gz gdb-5a1964ecbd3d7a66c626e2bb5edd7780b99f5aa9.tar.bz2 |
Fix calls to as_perror() so that the errno system message will be printed.
Fix as_perror() so that errno is not corrupted.
Diffstat (limited to 'gas/input-file.c')
-rw-r--r-- | gas/input-file.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/gas/input-file.c b/gas/input-file.c index bf36d5b..01cc669 100644 --- a/gas/input-file.c +++ b/gas/input-file.c @@ -151,18 +151,10 @@ input_file_open (char *filename, /* "" means use stdin. Must not be 0. */ if (f_in == NULL || ferror (f_in)) { - switch (errno) - { - case ENOENT: - as_bad (_("%s: no such file"), filename); - break; - case EISDIR: - as_bad (_("%s: is a directory"), filename); - break; - default: - as_bad (_("can't open %s for reading"), file_name); - as_perror ("%s", file_name); - } +#ifdef BFD_ASSEMBLER + bfd_set_error (bfd_error_system_call); +#endif + as_perror (_("Can't open %s for reading"), file_name); if (f_in) { @@ -227,6 +219,9 @@ input_file_get (char *buf, int buflen) size = fread (buf, sizeof (char), buflen, f_in); if (size < 0) { +#ifdef BFD_ASSEMBLER + bfd_set_error (bfd_error_system_call); +#endif as_perror (_("Can't read from %s"), file_name); size = 0; } @@ -253,6 +248,9 @@ 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) { +#ifdef BFD_ASSEMBLER + bfd_set_error (bfd_error_system_call); +#endif as_perror (_("Can't read from %s"), file_name); size = 0; } @@ -261,7 +259,12 @@ input_file_give_next_buffer (char *where /* Where to place 1st character of new else { if (fclose (f_in)) - as_perror (_("Can't close %s"), file_name); + { +#ifdef BFD_ASSEMBLER + bfd_set_error (bfd_error_system_call); +#endif + as_perror (_("Can't close %s"), file_name); + } f_in = (FILE *) 0; return_value = 0; } |