From abfe81c1fa43e83d4072b19a497bb74047dfd8df Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Thu, 15 Feb 2024 13:12:25 +0100 Subject: rest: remove .full.sum file when image is removed Remove .full.sum file too when user requests to remove an image. --- src/rest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rest.c b/src/rest.c index cf572bd..4709fc9 100644 --- a/src/rest.c +++ b/src/rest.c @@ -3356,7 +3356,7 @@ static int og_cmd_restore_image(json_t *element, struct og_msg_params *params) static int og_cmd_delete_image(json_t *element, struct og_msg_params *params) { - char filename[PATH_MAX + 1]; + char filename[PATH_MAX + 1], checksum[PATH_MAX + 1]; const char *key, *image; struct og_dbi *dbi; dbi_result result; @@ -3405,6 +3405,8 @@ static int og_cmd_delete_image(json_t *element, struct og_msg_params *params) image = dbi_result_get_string(result, "nombreca"); snprintf(filename, sizeof(filename), "%s/%s.img", ogconfig.repo.dir, image); + snprintf(checksum, sizeof(checksum), "%s/%s.img.full.sum", ogconfig.repo.dir, + image); dbi_result_free(result); result = dbi_conn_queryf(dbi->conn, @@ -3426,6 +3428,8 @@ static int og_cmd_delete_image(json_t *element, struct og_msg_params *params) dbi_result_free(result); unlink(filename); + unlink(checksum); + og_dbi_close(dbi); return 0; -- cgit v1.2.3-18-g5258