add a flag to ec3_image_ioctx_open to always delete an existing image if it already exists

This commit is contained in:
2025-02-24 15:43:40 +00:00
parent d4d26f53d6
commit 08e7cfd8eb
2 changed files with 7 additions and 0 deletions

View File

@@ -347,6 +347,12 @@ enum ec3_status ec3_image_ioctx_open(
}
b_path *image_path = b_path_create_from_cstr(path);
if (mode & EC3_IMAGE_IO_TRUNCATE) {
b_path_unlink(image_path);
mode &= ~EC3_IMAGE_IO_TRUNCATE;
}
b_file_info image_info;
enum b_status status = b_path_stat(image_path, &image_info);
enum ec3_status status2 = EC3_ERR_NO_ENTRY;