coverity: #1425767

Unchecked return value Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 7eab8fc6
...@@ -659,7 +659,7 @@ static void free_btrfs_tree(struct my_btrfs_tree *tree) ...@@ -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, static bool do_remove_btrfs_children(struct my_btrfs_tree *tree, u64 root_id,
const char *path) const char *path)
{ {
int i; int i, ret;
char *newpath; char *newpath;
size_t len; size_t len;
...@@ -675,7 +675,11 @@ static bool do_remove_btrfs_children(struct my_btrfs_tree *tree, u64 root_id, ...@@ -675,7 +675,11 @@ static bool do_remove_btrfs_children(struct my_btrfs_tree *tree, u64 root_id,
ERROR("Out of memory"); ERROR("Out of memory");
return false; 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)) { if (!do_remove_btrfs_children(tree, tree->nodes[i].objid, newpath)) {
ERROR("Failed to prune %s\n", tree->nodes[i].name); ERROR("Failed to prune %s\n", tree->nodes[i].name);
free(newpath); free(newpath);
......
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