Check exit value for snprintf where it makes sense.

This commit is contained in:
Milan Broz
2021-05-18 21:41:42 +02:00
parent 280c821b9b
commit df8135dfdf
16 changed files with 96 additions and 40 deletions

View File

@@ -234,8 +234,9 @@ static char *_sysfs_backing_file(const char *loop)
if (stat(loop, &st) || !S_ISBLK(st.st_mode))
return NULL;
snprintf(buf, sizeof(buf), "/sys/dev/block/%d:%d/loop/backing_file",
major(st.st_rdev), minor(st.st_rdev));
if (snprintf(buf, sizeof(buf), "/sys/dev/block/%d:%d/loop/backing_file",
major(st.st_rdev), minor(st.st_rdev)) < 0)
return NULL;
fd = open(buf, O_RDONLY);
if (fd < 0)