[cairo] [PATCH 2/6] test: Handle error in fgets call in ps-eps test

Bryce W. Harrington b.harrington at samsung.com
Wed Jan 29 18:14:14 PST 2014


Most likely this is just a theoretical problem since we just checked
feof, but this quells the following warning:

ps-eps.c:216:8: warning: ignoring return value of ‘fgets’, declared with
attribute warn_unused_result [-Wunused-result]

Signed-off-by: Bryce Harrington <b.harrington at samsung.com>
---
 test/ps-eps.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/ps-eps.c b/test/ps-eps.c
index 66224e2..de1248d 100644
--- a/test/ps-eps.c
+++ b/test/ps-eps.c
@@ -213,7 +213,11 @@ check_bbox (cairo_test_context_t *ctx,
     bbox_pass = FALSE;
     page_bbox_pass = FALSE;
     while (!feof(f)) {
-	fgets (buf, sizeof(buf), f);
+	if (fgets (buf, sizeof(buf), f) == (char *)EOF) {
+	    cairo_test_log (ctx, "Error: Unexpected EOF in %s\n",
+			    filename);
+	    break;
+	}
 
 	if (strncmp (buf, DOCUMENT_BBOX, strlen (DOCUMENT_BBOX)) == 0) {
 	    ret = sscanf (buf+strlen (DOCUMENT_BBOX), "%d %d %d %d", &llx, &lly, &urx, &ury);
-- 
1.7.9.5


More information about the cairo mailing list