]> git.alsa-project.org Git - alsa-utils.git/commitdiff
topology: fix the include path parsing
authorJaroslav Kysela <perex@perex.cz>
Tue, 7 Dec 2021 08:39:12 +0000 (09:39 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 7 Dec 2021 08:39:28 +0000 (09:39 +0100)
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 <perex@perex.cz>
topology/topology.c

index 44184d3d993d6fd226faa495d360762b48b61e7f..1f47401280f63ce919b06faa91c4cd2fa7f08e9f 100644 (file)
@@ -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;
 }