bdev: enable building with gcc7

We shouldn't ignore this anyway. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 1f561a9f
...@@ -1917,6 +1917,8 @@ static int find_free_loopdev_no_control(int *retfd, char *namep) ...@@ -1917,6 +1917,8 @@ static int find_free_loopdev_no_control(int *retfd, char *namep)
} }
while ((direntp = readdir(dir))) { while ((direntp = readdir(dir))) {
int ret;
if (!direntp) if (!direntp)
break; break;
if (strncmp(direntp->d_name, "loop", 4) != 0) if (strncmp(direntp->d_name, "loop", 4) != 0)
...@@ -1930,7 +1932,11 @@ static int find_free_loopdev_no_control(int *retfd, char *namep) ...@@ -1930,7 +1932,11 @@ static int find_free_loopdev_no_control(int *retfd, char *namep)
continue; continue;
} }
// We can use this fd // We can use this fd
snprintf(namep, 100, "/dev/%s", direntp->d_name); ret = snprintf(namep, 100, "/dev/%s", direntp->d_name);
if (ret < 0 || ret >= 100) {
close(fd);
fd = -1;
}
break; break;
} }
closedir(dir); closedir(dir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment