From 3a2d9ffe0333090bb31ff01048ed506595f20cf9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 26 Apr 2010 18:17:49 +0100 Subject: [PATCH] trace: Check return value to suppress compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit trace.c: In function ‘get_prog_name’: trace.c:741: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result --- util/cairo-trace/trace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index d577c5510..2dd6e2520 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -738,8 +738,11 @@ get_prog_name (char *buf, int length) file = fopen ("/proc/self/cmdline", "rb"); if (file != NULL) { - fgets (buf, length, file); + slash = fgets (buf, length, file); fclose (file); + + if (slash == NULL) + return; } else { char const *name = getenv ("CAIRO_TRACE_PROG_NAME"); if (name != NULL) {