trace: Check return value to suppress compiler warning

trace.c: In function ‘get_prog_name’:
trace.c:741: warning: ignoring return value of ‘fgets’, declared with
attribute warn_unused_result
This commit is contained in:
Chris Wilson 2010-04-26 18:17:49 +01:00
parent 37be183412
commit 3a2d9ffe03

View file

@ -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) {