mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 00:10:04 +01:00
Check exit value for snprintf where it makes sense.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user