diff options
Diffstat (limited to 'usr.sbin/pkg_install/add')
-rw-r--r-- | usr.sbin/pkg_install/add/perform.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index e1ef7a3..90d4420 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -267,8 +267,12 @@ pkg_do(char *pkg) if (!Fake) { if (!isURL(pkg) && !getenv("PKG_ADD_BASE")) { - /* XXX: need to handle .tgz also */ - snprintf(path, FILENAME_MAX, "%s/%s.tbz", getenv("_TOP"), p->name); + const char *ext; + + ext = strrchr(pkg_fullname, '.'); + if (ext == NULL) + ext = ".tbz"; + snprintf(path, FILENAME_MAX, "%s/%s%s", getenv("_TOP"), p->name, ext); if (fexists(path)) cp = path; else |