igt.cocci: check the return values of various functions

Add rules to fix unused-result warnings when compiling with
_FORTIFY_SOURCE defined and apply them to the library and tests.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood
2015-03-25 16:42:57 +00:00
parent 0c4dd28d2d
commit 47f6b1305c
11 changed files with 58 additions and 29 deletions
+2 -2
View File
@@ -198,7 +198,7 @@ static bool fbc_enabled(data_t *data)
status = igt_debugfs_fopen("i915_fbc_status", "r");
igt_assert(status);
fread(str, sizeof(str) - 1, 1, status);
igt_assert_eq(fread(str, sizeof(str) - 1, 1, status), 1);
fclose(status);
return strstr(str, "FBC enabled") != NULL;
}
@@ -510,7 +510,7 @@ igt_main
status = igt_debugfs_fopen("i915_fbc_status", "r");
igt_require_f(status, "No i915_fbc_status found\n");
fread(buf, sizeof(buf), 1, status);
igt_assert_eq(fread(buf, sizeof(buf), 1, status), sizeof(buf));
fclose(status);
buf[sizeof(buf) - 1] = '\0';
igt_require_f(!strstr(buf, "unsupported by this chipset") &&