summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorpav <pav@FreeBSD.org>2007-02-07 19:44:44 +0000
committerpav <pav@FreeBSD.org>2007-02-07 19:44:44 +0000
commit27ee9044d243bf71e0213ad0f88e42643473278f (patch)
tree2f9cb376e69c63b4fd1f57e86e9d22bd29d952e6 /usr.sbin
parent0245423ad8e92e117cd3b11f9a4c86428f0b5f55 (diff)
downloadFreeBSD-src-27ee9044d243bf71e0213ad0f88e42643473278f.zip
FreeBSD-src-27ee9044d243bf71e0213ad0f88e42643473278f.tar.gz
Fix a bug in 1.40 - it missed three occurences in pkg_info which leads to
(null)/file output. MFC after: 1 week
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_install/info/show.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c
index a1f9e8d..c65c312 100644
--- a/usr.sbin/pkg_install/info/show.c
+++ b/usr.sbin/pkg_install/info/show.c
@@ -213,6 +213,7 @@ show_files(const char *title, Package *plist)
{
PackingList p;
Boolean ign = FALSE;
+ char *prefix = NULL;
const char *dir = ".";
if (!Quiet)
@@ -227,7 +228,12 @@ show_files(const char *title, Package *plist)
break;
case PLIST_CWD:
- dir = p->name;
+ if (!prefix)
+ prefix = p->name;
+ if (p->name == NULL)
+ dir = prefix;
+ else
+ dir = p->name;
break;
case PLIST_IGNORE:
@@ -255,6 +261,7 @@ show_size(const char *title, Package *plist)
long blksize;
int headerlen;
char *descr;
+ char *prefix = NULL;
descr = getbsize(&headerlen, &blksize);
if (!Quiet)
@@ -274,7 +281,12 @@ show_size(const char *title, Package *plist)
break;
case PLIST_CWD:
- dir = p->name;
+ if (!prefix)
+ prefix = p->name;
+ if (p->name == NULL)
+ dir = prefix;
+ else
+ dir = p->name;
break;
case PLIST_IGNORE:
@@ -301,15 +313,21 @@ show_cksum(const char *title, Package *plist)
{
PackingList p;
const char *dir = ".";
+ char *prefix = NULL;
char tmp[FILENAME_MAX];
if (!Quiet)
printf("%s%s", InfoPrefix, title);
for (p = plist->head; p != NULL; p = p->next)
- if (p->type == PLIST_CWD)
- dir = p->name;
- else if (p->type == PLIST_FILE) {
+ if (p->type == PLIST_CWD) {
+ if (!prefix)
+ prefix = p->name;
+ if (p->name == NULL)
+ dir = prefix;
+ else
+ dir = p->name;
+ } else if (p->type == PLIST_FILE) {
snprintf(tmp, FILENAME_MAX, "%s/%s", dir, p->name);
if (!fexists(tmp))
warnx("%s doesn't exist", tmp);
OpenPOWER on IntegriCloud