sg: check for error in fcntl() restore of flags
authorJens Axboe <axboe@fb.com>
Tue, 15 Apr 2014 14:30:06 +0000 (08:30 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 15 Apr 2014 14:30:06 +0000 (08:30 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
engines/sg.c

index fcd9c41397a8bf20644b04336c2020bdc63b2215..87fe88352f2fd0d4eb77430e827cb4ffab8dbc92 100644 (file)
@@ -142,8 +142,10 @@ re_read:
        }
 
        if (!min) {
        }
 
        if (!min) {
-               for_each_file(td, f, i)
-                       fcntl(f->fd, F_SETFL, sd->fd_flags[i]);
+               for_each_file(td, f, i) {
+                       if (fcntl(f->fd, F_SETFL, sd->fd_flags[i]) < 0)
+                               log_err("fio: sg failed to restore fcntl flags: %s\n", strerror(errno));
+               }
        }
 
        return r;
        }
 
        return r;