If we use jobname as file, only append job/file numer for nrfiles > 1
authorJens Axboe <jens.axboe@oracle.com>
Tue, 13 Mar 2007 10:17:07 +0000 (11:17 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 13 Mar 2007 10:17:07 +0000 (11:17 +0100)
Otherwise we break the abillity to do [/dev/sda] for /dev/sda and
so on.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
init.c

diff --git a/init.c b/init.c
index ea531591eed47b4e9c7ce2b67cad7f97c2cfef8d..ba932bf369ce2ab3ffe3b838d18f09c4cf4b4f47 100644 (file)
--- a/init.c
+++ b/init.c
@@ -832,9 +832,13 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
        if (!td->filename) {
                td->filename = strdup(jobname);
 
        if (!td->filename) {
                td->filename = strdup(jobname);
 
-               for (i = 0; i < td->nr_files; i++) {
-                       sprintf(fname, "%s.%d.%d", td->filename, td->thread_number, i);
-                       add_file(td, fname);
+               if (td->nr_files == 1)
+                       add_file(td, td->filename);
+               else {
+                       for (i = 0; i < td->nr_files; i++) {
+                               sprintf(fname, "%s.%d.%d", td->filename, td->thread_number, i);
+                               add_file(td, fname);
+                       }
                }
        }
 
                }
        }