diff options
author | dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-24 15:34:03 +0000 |
---|---|---|
committer | dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-24 15:34:03 +0000 |
commit | c1cc44196c755aeff94df9dea818b030f112e7a3 (patch) | |
tree | 4a0d530478e4a3581cd9b8579761fcf864874518 /gcc | |
parent | e9185b9db30b857c3906b4000cac94f6ab85f292 (diff) | |
download | gcc-c1cc44196c755aeff94df9dea818b030f112e7a3.tar.gz |
Avoid crashing when an input file could not be opened
* input.c (add_file_to_cache_tab): Handle the case where fopen
returns NULL.
Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207046 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/input.c | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cdbedadc64c..7feb332d94b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-01-24 Dodji Seketeli <dodji@redhat.com> + + * input.c (add_file_to_cache_tab): Handle the case where fopen + returns NULL. + 2014-01-23 H.J. Lu <hongjiu.lu@intel.com> PR target/59929 diff --git a/gcc/input.c b/gcc/input.c index 290680c1e5a..547c177b09f 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -293,11 +293,8 @@ add_file_to_cache_tab (const char *file_path) { FILE *fp = fopen (file_path, "r"); - if (ferror (fp)) - { - fclose (fp); - return NULL; - } + if (fp == NULL) + return NULL; unsigned highest_use_count = 0; fcache *r = evicted_cache_tab_entry (&highest_use_count); |