[PATCH] fio: don't prepend directory to filename unless it is set
authorJens Axboe <axboe@suse.de>
Wed, 30 Nov 2005 10:52:42 +0000 (11:52 +0100)
committerJens Axboe <axboe@suse.de>
Wed, 30 Nov 2005 10:52:42 +0000 (11:52 +0100)
fio-ini.c

index 6fb4415f50a97e82ba39370f9c39b2d331f68c9f..2e6220fa83b802fa528bb25178072e6caa9d35cc 100644 (file)
--- a/fio-ini.c
+++ b/fio-ini.c
@@ -105,8 +105,6 @@ static struct thread_data *get_new_job(int global, struct thread_data *parent)
        td = &threads[thread_number++];
        memset(td, 0, sizeof(*td));
 
-       sprintf(td->directory, ".");
-
        td->fd = -1;
        td->thread_number = thread_number;
 
@@ -166,9 +164,12 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass,
        if (!stat(jobname, &sb) && S_ISBLK(sb.st_mode))
                td->filetype = FIO_TYPE_BD;
 
-       if (td->filetype == FIO_TYPE_FILE)
-               sprintf(td->file_name, "%s/%s.%d", td->directory, jobname, td->thread_number);
-       else
+       if (td->filetype == FIO_TYPE_FILE) {
+               if (td->directory[0] != '\0')
+                       sprintf(td->file_name, "%s/%s.%d", td->directory, jobname, td->thread_number);
+               else
+                       sprintf(td->file_name, "%s.%d", jobname, td->thread_number);
+       } else
                strcpy(td->file_name, jobname);
 
        sem_init(&td->mutex, 1, 0);