verify: escape '/' in state file name to '.'
[fio.git] / verify-state.h
index f1dc069ec68f4c928f5aca9a0dad9d9c3519cc4e..2fe710f19f9f2f5aeb95c2a9e4d21c25acfd88c3 100644 (file)
@@ -2,6 +2,7 @@
 #define FIO_VERIFY_STATE_H
 
 #include <stdint.h>
+#include <string.h>
 
 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