summaryrefslogtreecommitdiff
path: root/gcc/input.c
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-24 15:34:03 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-24 15:34:03 +0000
commitc1cc44196c755aeff94df9dea818b030f112e7a3 (patch)
tree4a0d530478e4a3581cd9b8579761fcf864874518 /gcc/input.c
parente9185b9db30b857c3906b4000cac94f6ab85f292 (diff)
downloadgcc-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/input.c')
-rw-r--r--gcc/input.c7
1 files changed, 2 insertions, 5 deletions
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);