Fix bug with numjobs > 1, directory and filename given

Reported by gurudas pai <gurudas.pai@oracle.com>

If numjobs > 1, add_job() will append the directory name
several times. Fix this by doing the directory append in
add_file() instead, it cleans up the code as well.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/filesetup.c b/filesetup.c
index 1426b15..f6e2a19 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -569,14 +569,21 @@
 void add_file(struct thread_data *td, const char *fname)
 {
 	int cur_files = td->files_index;
+	char file_name[PATH_MAX];
 	struct fio_file *f;
+	int len = 0;
 
 	td->files = realloc(td->files, (cur_files + 1) * sizeof(*f));
 
 	f = &td->files[cur_files];
 	memset(f, 0, sizeof(*f));
 	f->fd = -1;
-	f->file_name = strdup(fname);
+
+	if (td->o.directory)
+		len = sprintf(file_name, "%s/", td->o.directory);
+
+	sprintf(file_name + len, "%s", fname);
+	f->file_name = strdup(file_name);
 
 	get_file_type(f);