From 80df1d128f0f3ae3ad8231195a71640cd3cbb276 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 2 Dec 2022 11:40:43 +0000 Subject: [PATCH] dependencies: Log any invalid dependencies Signed-off-by: Michael Tremer --- src/libpakfire/dependencies.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libpakfire/dependencies.c b/src/libpakfire/dependencies.c index e59f743d0..4fa7b0f65 100644 --- a/src/libpakfire/dependencies.c +++ b/src/libpakfire/dependencies.c @@ -288,19 +288,21 @@ static Id pakfire_parse_rich_dep(struct pakfire* pakfire, const char** dep, int return pool_rel2id(pool, id, evr, flags, 1); } -Id pakfire_str2dep(struct pakfire* pakfire, const char* s) { +Id pakfire_str2dep(struct pakfire* pakfire, const char* dep) { Id id = ID_NULL; // Invalid input - if (!s) { + if (!dep) { errno = EINVAL; return id; } // Ignore empty strings - if (!*s) + if (!*dep) return id; + const char* s = dep; + // Consume any leading space if (isspace(*s)) s++; @@ -316,8 +318,10 @@ Id pakfire_str2dep(struct pakfire* pakfire, const char* s) { id = pakfire_parse_dep(pakfire, &s); // Return nothing if we could not parse the entire string - if (id && *s) + if (id && *s) { + DEBUG(pakfire, "Invalid dependency: %s\n", dep); id = ID_NULL; + } return id; } -- 2.39.5