Fix crash with --debug=file and NULL file return
authorJens Axboe <axboe@fb.com>
Tue, 25 Feb 2014 21:43:17 +0000 (13:43 -0800)
committerJens Axboe <axboe@fb.com>
Tue, 25 Feb 2014 21:43:17 +0000 (13:43 -0800)
Don't attempt to dereference that, obviously.

Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index 619fa25..a69efb7 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1093,7 +1093,10 @@ static struct fio_file *__get_next_file(struct thread_data *td)
        td->file_service_file = f;
        td->file_service_left = td->file_service_nr - 1;
 out:
-       dprint(FD_FILE, "get_next_file: %p [%s]\n", f, f->file_name);
+       if (f)
+               dprint(FD_FILE, "get_next_file: %p [%s]\n", f, f->file_name);
+       else
+               dprint(FD_FILE, "get_next_file: NULL\n");
        return f;
 }