Skip to contentSkip to conversation

image_renderer: Use read_file_2

PATCH New Sascha Hauer 1 participant 1 message Jun 25, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image_renderer: Use read_file_2

This returns a proper error code and allows us to print a proper error message which might not always be -ENOMEM.

---
 lib/gui/image_renderer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/gui/image_renderer.c +4 -4
index dd29389..9bef99a 100644
@@ -37,10 +37,10 @@ struct image *image_renderer_open(const char* file)
 	struct image *img;
 	int ret;
 
-	data = read_file(file, &size);
-	if (!data) {
-		printf("unable to read %s\n", file);
-		return ERR_PTR(-ENOMEM);
+	ret = read_file_2(file, &size, &data, FILESIZE_MAX);
+	if (ret) {
+		printf("unable to read %s: %s\n", file, strerror(-ret));
+		return ERR_PTR(ret);
 	}
 
 	ir = get_renderer(data, size);
Signature · 7 lines
2.1.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox