diff --git a/pkg.c b/pkg.c index dbc9d8d..fbfc6cc 100644 --- a/pkg.c +++ b/pkg.c @@ -131,7 +131,10 @@ pkg_get_parent_dir(pkg_t *pkg) char *pathbuf; strlcpy(buf, pkg->filename, sizeof buf); - if ((pathbuf = strrchr(buf, PKG_DIR_SEP_S)) != NULL) + pathbuf = strrchr(buf, PKG_DIR_SEP_S); + if (pathbuf == NULL) + pathbuf = strrchr(buf, '/'); + if (pathbuf != NULL) pathbuf[0] = '\0'; return buf;