Fix problem with duplicate entries when changing from LEAF to NODE;

only the first link of a inode was being removed, not all of them.
From Kirk McKusick <mckusick@McKusick.COM> via thorpej
This commit is contained in:
lukem 1997-06-18 07:10:16 +00:00
parent a066eecaf8
commit b45dc84835

View File

@ -1,4 +1,4 @@
/* $NetBSD: restore.c,v 1.8 1997/03/19 08:42:53 lukem Exp $ */
/* $NetBSD: restore.c,v 1.9 1997/06/18 07:10:16 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)restore.c 8.3 (Berkeley) 9/13/94";
#else
static char rcsid[] = "$NetBSD: restore.c,v 1.8 1997/03/19 08:42:53 lukem Exp $";
static char rcsid[] = "$NetBSD: restore.c,v 1.9 1997/06/18 07:10:16 lukem Exp $";
#endif
#endif /* not lint */
@ -434,8 +434,13 @@ nodeupdates(name, ino, type)
}
if (ip->e_type == LEAF) {
/* changing from leaf to node */
removeleaf(ip);
freeentry(ip);
for ( ; ip != NULL; ip = ip->e_links) {
if (ip->e_type != LEAF)
badentry(ip,
"NODE and LEAF links to same inode");
removeleaf(ip);
freeentry(ip);
}
ip = addentry(name, ino, type);
newnode(ip);
} else {