summaryrefslogtreecommitdiff
path: root/util/cairo-trace/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/cairo-trace/trace.c')
-rw-r--r--util/cairo-trace/trace.c5
1 files changed, 4 insertions, 1 deletions
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) {