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> From-SVN: r207046
This commit is contained in:
parent
f27ad2b220
commit
317363b4c1
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue