+static bool create_work_dirs(struct thread_data *td, const char *fname)
+{
+ char path[PATH_MAX];
+ char *start, *end;
+ int offset;
+
+ snprintf(path, PATH_MAX, "%s", fname);
+ start = path;
+
+ offset = longest_existing_path(path);
+ end = start + offset;
+ while ((end = strchr(end, FIO_OS_PATH_SEPARATOR)) != NULL) {
+ if (end == start) {
+ end++;
+ continue;
+ }
+ *end = '\0';
+ errno = 0;
+ if (fio_mkdir(path, 0700) && errno != EEXIST) {
+ log_err("fio: failed to create dir (%s): %s\n",
+ start, strerror(errno));
+ return false;
+ }
+ *end = FIO_OS_PATH_SEPARATOR;
+ end++;
+ }
+ td->flags |= TD_F_DIRS_CREATED;
+ return true;
+}
+