Fix potential segfault on ENOENT on job file
authorJens Axboe <axboe@fb.com>
Wed, 8 Oct 2014 15:55:22 +0000 (09:55 -0600)
committerJens Axboe <axboe@fb.com>
Wed, 8 Oct 2014 15:55:22 +0000 (09:55 -0600)
Introduced in commit 323255cc2269, if we fail opening, td may
not be set.

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

diff --git a/init.c b/init.c
index a2377dc95e33c1499340037cae86b3b436ad2db6..17684787441cde5c8cad6c1405a4f660b8d66615 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1432,7 +1432,8 @@ int __parse_jobs_ini(struct thread_data *td,
                        int __err = errno;
 
                        log_err("fio: unable to open '%s' job file\n", file);
                        int __err = errno;
 
                        log_err("fio: unable to open '%s' job file\n", file);
-                       td_verror(td, __err, "job file open");
+                       if (td)
+                               td_verror(td, __err, "job file open");
                        return 1;
                }
        }
                        return 1;
                }
        }