Added space reservation

This commit is contained in:
2024-02-20 14:54:04 +01:00
parent a260002a6c
commit af34a9c260
6 changed files with 177 additions and 7 deletions

View File

@@ -177,12 +177,13 @@ result_t import_backing(char** _backing, const char* disk) {
if (info.backing_path != NULL) {
// Get the backing identifier of the parent
errno = 0;
char* backing = strdup(basename(info.backing_path));
if (backing == NULL) {
free_disk_info(&info);
remove(temp_path);
free(temp_path);
return failure("Failed to get the backing identifier of the parent.");
return failure("Failed to get the backing identifier of the parent of '%s' (%s).", disk, strerror(errno));
}
// Check that the backing exists
@@ -406,13 +407,14 @@ result_t get_backing_parent(char** _parent, const char* backing) {
}
// Get the backing identifier of the parent
errno = 0;
char* parent = strdup(basename(info.backing_path));
// Free the disk info as it is not needed anymore
free_disk_info(&info);
if (parent == NULL)
return failure("Failed to get the backing identifier of the parent.");
return failure("Failed to get the backing identifier of the parent of '%s' (%s).", backing, strerror(errno));
*_parent = parent;
return success();