}
if (td->filetype == FIO_TYPE_FILE) {
- if (td->directory[0] != '\0')
+ if (td->directory && td->directory[0] != '\0')
sprintf(td->file_name, "%s/%s.%d", td->directory, jobname, td->jobnum);
else
sprintf(td->file_name, "%s.%d", jobname, td->jobnum);
static int str_iolog_cb(struct thread_data *td, char *file)
{
- strncpy(td->iolog_file, file, sizeof(td->iolog_file) - 1);
+ td->iolog_file = strdup(file);
return 0;
}
unsigned long long ull;
unsigned long ul1, ul2;
struct thread_data *td;
- char *string, *name;
+ char *string, *name, *tmpbuf;
fpos_t off;
FILE *f;
char *p;
string = malloc(4096);
name = malloc(256);
+ tmpbuf = malloc(4096);
while ((p = fgets(string, 4096, f)) != NULL) {
if (is_empty_or_comment(p))
fgetpos(f, &off);
continue;
}
- if (!check_strstore(p, "directory", td->directory)) {
+ if (!check_strstore(p, "directory", tmpbuf)) {
+ td->directory = strdup(tmpbuf);
fgetpos(f, &off);
continue;
}
free(string);
free(name);
+ free(tmpbuf);
fclose(f);
return 0;
}