Commit 317363b4 by Dodji Seketeli Committed by Dodji Seketeli

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
parent f27ad2b2
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment