From: Jaroslav Kysela Date: Tue, 7 Dec 2021 08:39:12 +0000 (+0100) Subject: topology: fix the include path parsing X-Git-Tag: v1.2.7~44 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=7692cfa0c5699adcf489e281114910c078e43476;p=alsa-utils.git 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 --- 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; }