1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-04 17:15:50 +00:00

Fix a bug where pkg_create does not make an md5 entry for the last item in

the packing list. Also use switch() instead of zillion "else if ()" and for()
loop instead of while() loop for traversing through linked list.

MFC candidate.

Submitted by:	Alec Wolman <wolman@cs.washington.edu>
This commit is contained in:
Maxim Sobolev 2001-01-12 11:36:12 +00:00
parent 3abc34d763
commit 242b263cbc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=70964

View File

@ -35,19 +35,21 @@ check_list(char *home, Package *pkg)
{
char *where = home;
char *there = NULL;
PackingList p = pkg->head;
while (p) {
if (p->type == PLIST_CWD)
where = p->name;
else if (p->type == PLIST_IGNORE)
p = p->next;
else if (p->type == PLIST_SRC) {
there = p->name;
}
else if (p->type == PLIST_FILE) {
char *cp, name[FILENAME_MAX], buf[33];
PackingList p;
for (p = pkg->head; p != NULL; p = p->next)
switch (p->type) {
case PLIST_CWD:
where = p->name;
break;
case PLIST_IGNORE:
p = p->next;
break;
case PLIST_SRC:
there = p->name;
break;
case PLIST_FILE:
sprintf(name, "%s/%s", there ? there : where, p->name);
if ((cp = MD5File(name, buf)) != NULL) {
PackingList tmp = new_plist_entry();
@ -57,10 +59,13 @@ check_list(char *home, Package *pkg)
tmp->next = p->next;
tmp->prev = p;
p->next = tmp;
if (pkg->tail == p)
pkg->tail = tmp;
p = tmp;
}
}
p = p->next;
break;
default:
break;
}
}