Properly initialize shadow_fd to -1
[fio.git] / filesetup.c
index 5ce0f6803ae7d952c262d25728b1a60ec7bff86f..fd55cc4b2bc4c98723194a3a655d420f82bb6c79 100644 (file)
@@ -1109,7 +1109,8 @@ static void get_file_type(struct fio_file *f)
        }
 }
 
-static void set_already_allocated(const char *fname) {
+static void set_already_allocated(const char *fname)
+{
        struct file_name *fn;
 
        fn = malloc(sizeof(struct file_name));
@@ -1135,7 +1136,8 @@ static int is_already_allocated(const char *fname)
        return 0;
 }
 
-static void free_already_allocated() {
+static void free_already_allocated(void)
+{
        struct flist_head *entry, *tmp;
        struct file_name *fn;
 
@@ -1419,6 +1421,7 @@ void dup_files(struct thread_data *td, struct thread_data *org)
                        assert(0);
                }
                __f->fd = -1;
+               __f->shadow_fd = -1;
                fio_file_reset(td, __f);
 
                if (f->file_name) {
@@ -1488,6 +1491,7 @@ int fio_files_done(struct thread_data *td)
 }
 
 /* free memory used in initialization phase only */
-void filesetup_mem_free() {
+void filesetup_mem_free(void)
+{
        free_already_allocated();
 }