summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install/lib
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-10 23:00:16 +0000
committerjkh <jkh@FreeBSD.org>1995-05-10 23:00:16 +0000
commitfd82b3cc6a0b17cf6d88502f54836c2783332e13 (patch)
treeb9bdc809828e6d82d9f525a46ccf1f77774c0add /usr.sbin/pkg_install/lib
parent6e78c7b340089cbe39a50a2c0a190937ea1c9ada (diff)
downloadFreeBSD-src-fd82b3cc6a0b17cf6d88502f54836c2783332e13.zip
FreeBSD-src-fd82b3cc6a0b17cf6d88502f54836c2783332e13.tar.gz
Fix a long-standing bug that broke pkg_info utterly and probably made
pkg_add a little wiggy too.
Diffstat (limited to 'usr.sbin/pkg_install/lib')
-rw-r--r--usr.sbin/pkg_install/lib/file.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c
index 8c6addc..e4c413b 100644
--- a/usr.sbin/pkg_install/lib/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char *rcsid = "$Id: file.c,v 1.7 1995/04/22 13:58:42 jkh Exp $";
+static const char *rcsid = "$Id: file.c,v 1.8 1995/04/26 15:08:20 jkh Exp $";
#endif
/*
@@ -255,20 +255,19 @@ fileFindByPath(char *fname)
static char tmp[FILENAME_MAX];
char *cp;
+ if (fexists(fname)) {
+ strcpy(tmp, fname);
+ return tmp;
+ }
cp = getenv("PKG_PATH");
- if (!cp)
- whinge("Warning: PKG_PATH environment variable not set.");
- tmp[0] = '\0';
while (cp) {
char *cp2 = strsep(&cp, ":");
snprintf(tmp, FILENAME_MAX, "%s/%s.tgz", cp2 ? cp2 : cp, fname);
if (fexists(tmp))
- break;
- else
- tmp[0] = '\0';
+ return tmp;
}
- return tmp;
+ return NULL;
}
char *
OpenPOWER on IntegriCloud