Make it work on opensolaris
[fio.git] / log.c
diff --git a/log.c b/log.c
index 790d3a1e32c9d4c046bb17be0f10f44a74f5fef3..191f806aa2e471747f8c561ba59365c4f2269ad9 100644 (file)
--- a/log.c
+++ b/log.c
@@ -4,6 +4,7 @@
  */
 #include <stdio.h>
 #include <stdlib.h>
+#include <libgen.h>
 #include <assert.h>
 #include "list.h"
 #include "fio.h"
@@ -40,6 +41,13 @@ void log_file(struct thread_data *td, struct fio_file *f,
        if (!td->o.write_iolog_file)
                return;
 
+
+       /*
+        * this happens on the pre-open/close done before the job starts
+        */
+       if (!td->iolog_f)
+               return;
+
        fprintf(td->iolog_f, "%s %s\n", f->file_name, act[what]);
 }