diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-15 13:12:25 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-15 13:12:25 +0100 |
commit | abfe81c1fa43e83d4072b19a497bb74047dfd8df (patch) | |
tree | 5c4f63c11c5dc97181730870bf40209640e65da0 | |
parent | 892f0491356910aed30de4946878e3ff2a81abe9 (diff) |
rest: remove .full.sum file when image is removed
Remove .full.sum file too when user requests to remove an image.
-rw-r--r-- | src/rest.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; |