From de0d7a335c76cd158f69d83788985ed05db5756b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 30 Jan 2012 17:53:48 -0500 Subject: [PATCH] Emit meaningful error messages That is useful, even if this is only an internal tool. I have been scratching my head why this tool would break distcheck... --- gio/data-to-c.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gio/data-to-c.c b/gio/data-to-c.c index b20369f01..9dcf286bf 100644 --- a/gio/data-to-c.c +++ b/gio/data-to-c.c @@ -26,12 +26,19 @@ main (int argc, char **argv) { char *content; int i; + GError *error = NULL; if (argc != 3) - return 1; + { + g_printerr ("Usage: data-to-c "); + return 1; + } - if (!g_file_get_contents (argv[1], &content, NULL, NULL)) - return 1; + if (!g_file_get_contents (argv[1], &content, NULL, &error)) + { + g_printerr ("%s", error->message); + return 1; + } g_print ("const char %s[] = \"", argv[2]);