From d33664a54f05bc6a4d8aaf39f855f3daa39dc2c3 Mon Sep 17 00:00:00 2001 From: Felicity Date: Wed, 11 Dec 2024 02:55:44 +0000 Subject: [PATCH] Split the last hyphen to retrieve the correct component name --- ggdeploymentd/src/component_store.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ggdeploymentd/src/component_store.c b/ggdeploymentd/src/component_store.c index e3b8825d8..8da7da370 100644 --- a/ggdeploymentd/src/component_store.c +++ b/ggdeploymentd/src/component_store.c @@ -84,10 +84,10 @@ GglError iterate_over_components( GglBuffer entry_buf = ggl_buffer_from_null_term((*entry)->d_name); // recipe file names follow this format: // -. - // Split directory entry on the index of the "-" character. + // Split the last "-" character to retrieve the component name GglBuffer recipe_component; GglBuffer rest = GGL_STR(""); - for (size_t i = 0; i < entry_buf.len; ++i) { + for (size_t i = entry_buf.len; i-- > 0;) { if (entry_buf.data[i] == '-') { recipe_component = ggl_buffer_substr(entry_buf, 0, i); rest = ggl_buffer_substr(entry_buf, i + 1, SIZE_MAX);