Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-06-14 22:10:26 +02:00
parent 7eab8fc623
commit 76c00d391a
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -659,7 +659,7 @@ static void free_btrfs_tree(struct my_btrfs_tree *tree)
static bool do_remove_btrfs_children(struct my_btrfs_tree *tree, u64 root_id,
const char *path)
{
int i;
int i, ret;
char *newpath;
size_t len;
@ -675,7 +675,11 @@ static bool do_remove_btrfs_children(struct my_btrfs_tree *tree, u64 root_id,
ERROR("Out of memory");
return false;
}
snprintf(newpath, len, "%s/%s", path, tree->nodes[i].dirname);
ret = snprintf(newpath, len, "%s/%s", path, tree->nodes[i].dirname);
if (ret < 0 || ret >= len) {
free(newpath);
return false;
}
if (!do_remove_btrfs_children(tree, tree->nodes[i].objid, newpath)) {
ERROR("Failed to prune %s\n", tree->nodes[i].name);
free(newpath);