@@ -69,10 +69,10 @@ static int set_dev_loop_path(int dev, char *path, size_t path_len)
snprintf(path, path_len, dev_loop_variants[i], dev);
if (stat(path, &st) == 0 && S_ISBLK(st.st_mode))
- return 1;
+ return 0;
}
- return 0;
+ return 1;
}
int tst_find_free_loopdev(char *path, size_t path_len)
@@ -116,7 +116,7 @@ int tst_find_free_loopdev(char *path, size_t path_len)
*/
for (i = 0; i < 256; i++) {
- if (!set_dev_loop_path(i, buf, sizeof(buf)))
+ if (set_dev_loop_path(i, buf, sizeof(buf)))
continue;
dev_fd = open(buf, O_RDONLY);