Missed update of dup_files() for dynamically allocated files
[fio.git] / filesetup.c
index 483226ae56e5d488d4601a14c1ba29b93f91d360..b37de5b726b3203d27eed4c99281948d67a67ed3 100644 (file)
@@ -645,6 +645,14 @@ int put_file(struct thread_data *td, struct fio_file *f)
        return ret;
 }
 
+void lock_file(struct thread_data *td, struct fio_file *f)
+{
+}
+
+void unlock_file(struct fio_file *f)
+{
+}
+
 static int recurse_dir(struct thread_data *td, const char *dirname)
 {
        struct dirent *dir;
@@ -711,13 +719,20 @@ void dup_files(struct thread_data *td, struct thread_data *org)
        if (!org->files)
                return;
 
-       bytes = org->files_index * sizeof(*f);
+       bytes = org->files_index * sizeof(f);
        td->files = malloc(bytes);
        memcpy(td->files, org->files, bytes);
 
        for_each_file(td, f, i) {
+               struct fio_file *__f;
+
+               __f = malloc(sizeof(*__f));
+               memset(f, 0, sizeof(*__f));
+
                if (f->file_name)
-                       f->file_name = strdup(f->file_name);
+                       __f->file_name = strdup(f->file_name);
+
+               td->files[i] = __f;
        }
 }