From: Jens Axboe Date: Sat, 10 Feb 2007 13:59:22 +0000 (+0100) Subject: [PATCH] Catch and print if directory= doesn't exist X-Git-Tag: fio-1.12~113 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=16edf25dba269ee9e8239130e75b690440b1e120;ds=inline [PATCH] Catch and print if directory= doesn't exist Currently we fail in an odd way, make it more explicit why we fail. Signed-off-by: Jens Axboe --- diff --git a/init.c b/init.c index 7f2747a4..4fe1dce8 100644 --- a/init.c +++ b/init.c @@ -564,6 +564,9 @@ static void put_job(struct thread_data *td) if (td == &def_thread) return; + if (td->error) + fprintf(f_out, "fio: %s\n", td->verror); + memset(&threads[td->thread_number - 1], 0, sizeof(*td)); thread_number--; } @@ -694,8 +697,18 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num) char tmp[PATH_MAX]; int len = 0; - if (td->directory && td->directory[0] != '\0') + if (td->directory && td->directory[0] != '\0') { + if (lstat(td->directory, &sb) < 0) { + log_err("fio: %s is not a directory\n", td->directory); + td_verror(td, errno); + return 1; + } + if (!S_ISDIR(sb.st_mode)) { + log_err("fio: %s is not a directory\n", td->directory); + return 1; + } len = sprintf(tmp, "%s/", td->directory); + } td->files = malloc(sizeof(struct fio_file) * td->nr_files);