disk util: fix bug in strncpy() conversion
[fio.git] / diskutil.c
index 3ee5c6c871b4d4545ff0f9f34b0a4ef81e89e234..cb285cffb31d3137421518dbba6c5c42e14e1bbf 100644 (file)
@@ -300,7 +300,7 @@ static struct disk_util *disk_util_add(struct thread_data *td, int majdev,
                sfree(du);
                return NULL;
        }
-       strncpy((char *) du->dus.name, basename(path) - 1, FIO_DU_NAME_SZ);
+       strncpy((char *) du->dus.name, basename(path), FIO_DU_NAME_SZ - 1);
        du->sysfs_root = path;
        du->major = majdev;
        du->minor = mindev;