Fix a bug in 1.40 - it missed three occurences in pkg_info which leads to

(null)/file output.

MFC after:	1 week
This commit is contained in:
pav 2007-02-07 19:44:44 +00:00
parent 0245423ad8
commit 27ee9044d2

View File

@ -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);