Rev 5199 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5199 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* BFD library -- caching of file descriptors. |
1 | /* BFD library -- caching of file descriptors. |
Line 2... | Line -... | ||
2 | - | ||
3 | Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, |
2 | |
Line 4... | Line 3... | ||
4 | 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. |
3 | Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Line 5... | Line 4... | ||
5 | 4 | ||
Line 294... | Line 293... | ||
294 | the read failed due to an error set the bfd_error_system_call, |
293 | the read failed due to an error set the bfd_error_system_call, |
295 | else set bfd_error_file_truncated. */ |
294 | else set bfd_error_file_truncated. */ |
296 | if (nread == (file_ptr)-1) |
295 | if (nread == (file_ptr)-1) |
297 | { |
296 | { |
298 | bfd_set_error (bfd_error_system_call); |
297 | bfd_set_error (bfd_error_system_call); |
299 | return -1; |
298 | return nread; |
300 | } |
299 | } |
301 | #else |
300 | #else |
302 | nread = fread (buf, 1, nbytes, f); |
301 | nread = fread (buf, 1, nbytes, f); |
303 | /* Set bfd_error if we did not read as much data as we expected. If |
302 | /* Set bfd_error if we did not read as much data as we expected. If |
304 | the read failed due to an error set the bfd_error_system_call, |
303 | the read failed due to an error set the bfd_error_system_call, |
305 | else set bfd_error_file_truncated. */ |
304 | else set bfd_error_file_truncated. */ |
306 | if (nread < nbytes && ferror (f)) |
305 | if (nread < nbytes && ferror (f)) |
307 | { |
306 | { |
308 | bfd_set_error (bfd_error_system_call); |
307 | bfd_set_error (bfd_error_system_call); |
309 | return -1; |
308 | return nread; |
310 | } |
309 | } |
311 | #endif |
310 | #endif |
312 | if (nread < nbytes) |
311 | if (nread < nbytes) |
313 | /* This may or may not be an error, but in case the calling code |
312 | /* This may or may not be an error, but in case the calling code |
314 | bails out because of it, set the right error code. */ |
313 | bails out because of it, set the right error code. */ |