kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 8a39d1819606b81664218c890f5d6e60108e4a55
parent 30e9b642a01f4ae1cf5e8b7203def2b10c7c2e7a
Author: Joris Vink <joris@coders.se>
Date:   Tue,  9 Jun 2020 12:22:22 +0200

work around different dirname()/basename() implementations.

Diffstat:
src/python.c | 16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/python.c b/src/python.c @@ -2425,11 +2425,18 @@ python_import(const char *path) fatal("python_import: '%s' is not a file or directory", path); copy = kore_strdup(path); + if ((p = dirname(copy)) == NULL) + fatal("dirname: %s: %s", path, errno_s); + + dir = kore_strdup(p); + kore_free(copy); - if ((file = basename(copy)) == NULL) + copy = kore_strdup(path); + if ((p = basename(copy)) == NULL) fatal("basename: %s: %s", path, errno_s); - if ((dir = dirname(copy)) == NULL) - fatal("dirname: %s: %s", path, errno_s); + + file = kore_strdup(p); + kore_free(copy); if ((p = strrchr(file, '.')) != NULL) *p = '\0'; @@ -2443,7 +2450,8 @@ python_import(const char *path) if (module == NULL) PyErr_Print(); - kore_free(copy); + kore_free(dir); + kore_free(file); return (module); }