Avoid static checker complaining about a potential race here,
ordering doesn't matter to fio.
Signed-off-by: Jens Axboe <axboe@fb.com>
struct iolog_compress ic;
z_stream stream;
struct stat sb;
struct iolog_compress ic;
z_stream stream;
struct stat sb;
- if (stat(file, &sb) < 0) {
- perror("stat");
- return 1;
- }
-
f = fopen(file, "r");
if (!f) {
perror("fopen");
return 1;
}
f = fopen(file, "r");
if (!f) {
perror("fopen");
return 1;
}
+ if (stat(file, &sb) < 0) {
+ fclose(f);
+ perror("stat");
+ return 1;
+ }
+
ic.buf = malloc(sb.st_size);
ic.len = sb.st_size;
ic.nofree = 1;
ic.buf = malloc(sb.st_size);
ic.len = sb.st_size;
ic.nofree = 1;