From 7692cfa0c5699adcf489e281114910c078e43476 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 7 Dec 2021 09:39:12 +0100 Subject: [PATCH] topology: fix the include path parsing When the last '/' is not found use '.' as the source path. Fixes: https://github.com/alsa-project/alsa-utils/issues/123 Signed-off-by: Jaroslav Kysela --- topology/topology.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/topology/topology.c b/topology/topology.c index 44184d3..1f47401 100644 --- a/topology/topology.c +++ b/topology/topology.c @@ -240,8 +240,12 @@ static char *get_inc_path(const char *filename) { const char *s = strrchr(filename, '/'); char *r = strdup(filename); - if (r && s) - r[s - filename] = '\0'; + if (r) { + if (s) + r[s - filename] = '\0'; + else if (r[0]) + strcpy(r, "."); + } return r; }