tools/wrc/parser.y: Check return value of fread and report error. (bug # 16317)

titon barua titanix88 at gmail.com
Sun Jan 4 14:12:08 CST 2009


---
 tools/wrc/parser.y |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y
index c0cc2ba..03b7299 100644
--- a/tools/wrc/parser.y
+++ b/tools/wrc/parser.y
@@ -2363,7 +2363,10 @@ static raw_data_t *load_file(string_t *filename, language_t *lang)
 	if (rd->size)
 	{
 		rd->data = xmalloc(rd->size);
-		fread(rd->data, rd->size, 1, fp);
+		if (fread(rd->data, rd->size, 1, fp) != 1)
+		{
+			yyerror ("Error reading file %s into new raw data", name->str.cstr);
+		}
 	}
 	else rd->data = NULL;
 	fclose(fp);
-- 
1.5.6.3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-patches/attachments/20090105/51ff3281/attachment.htm 


More information about the wine-patches mailing list