blktrace: ensure that dev loop doesn't truncate name
[fio.git] / oslib / linux-dev-lookup.c
index 4d5f356c1774565e2e13a841377e7763e453448d..54017ff0164a7f735ac98915995ab9dc5698e262 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include "../os/os.h"
+#include "linux-dev-lookup.h"
 
 int blktrace_lookup_device(const char *redirect, char *path, unsigned int maj,
                           unsigned int min)
@@ -20,12 +20,12 @@ int blktrace_lookup_device(const char *redirect, char *path, unsigned int maj,
                return 0;
 
        while ((dir = readdir(D)) != NULL) {
-               char full_path[256];
+               char full_path[257];
 
                if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
                        continue;
 
-               sprintf(full_path, "%s%s%s", path, FIO_OS_PATH_SEPARATOR, dir->d_name);
+               sprintf(full_path, "%s/%s", path, dir->d_name);
                if (lstat(full_path, &st) == -1) {
                        perror("lstat");
                        break;