From e139c0c076e596143a13ce4cbf062120c30b338f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 10 May 2016 18:50:48 -0600 Subject: [PATCH] verify: escape '/' in state file name to '.' If the job name includes a front slash, then we get an error when we try to create the state file name: fio: open state file: No such file or directory Change the '/' to '.' instead, so we generate a valid file name. Signed-off-by: Jens Axboe --- verify-state.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/verify-state.h b/verify-state.h index f1dc069e..2fe710f1 100644 --- a/verify-state.h +++ b/verify-state.h @@ -2,6 +2,7 @@ #define FIO_VERIFY_STATE_H #include +#include struct thread_rand32_state { uint32_t s[4]; @@ -82,8 +83,21 @@ static inline void verify_state_gen_name(char *out, size_t size, const char *name, const char *prefix, int num) { + char *ptr; + snprintf(out, size, "%s-%s-%d-verify.state", prefix, name, num); out[size - 1] = '\0'; + + /* + * Escape '/', just turn them into '.' + */ + ptr = out; + while ((ptr = strchr(ptr, '/')) != NULL) { + *ptr = '.'; + ptr++; + if (*ptr == '\0') + break; + } } #endif -- 2.25.1