X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=restore%2Frestore.c;h=fe6c2ccd3454b0377dd2a994d5c26d3389c840db;hb=9be511dc8a07570d6c95075573272fce6e9113d4;hp=f1986a47b82030725fbdcea97337fbeacbb304e3;hpb=ddd2ef55b78a62c4bc3daad18bef8a90e85a2052;p=dump.git diff --git a/restore/restore.c b/restore/restore.c index f1986a4..fe6c2cc 100644 --- a/restore/restore.c +++ b/restore/restore.c @@ -2,8 +2,7 @@ * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit * Remy Card , 1994-1997 - * Stelian Pop , 1999 - * + * Stelian Pop , 1999-2000 */ /* @@ -40,11 +39,8 @@ */ #ifndef lint -#if 0 -static char sccsid[] = "@(#)restore.c 8.3 (Berkeley) 9/13/94"; -#endif static const char rcsid[] = - "$Id: restore.c,v 1.3 1999/10/11 12:59:20 stelian Exp $"; + "$Id: restore.c,v 1.10 2000/08/20 15:17:36 stelian Exp $"; #endif /* not lint */ #include @@ -93,7 +89,7 @@ listfile(char *name, ino_t ino, int type) long addfile(char *name, ino_t ino, int type) { - register struct entry *ep; + register struct entry *ep, *np; long descend = hflag ? GOOD : FAIL; char buf[100]; @@ -118,6 +114,11 @@ addfile(char *name, ino_t ino, int type) return (descend); } type |= LINK; + for (np = ep->e_links; np; np = np->e_links) + if (strcmp(name, myname(np)) == 0) { + np->e_flags |= NEW; + return (descend); + } } ep = addentry(name, ino, type); if (type == NODE) @@ -485,6 +486,7 @@ nodeupdates(char *name, ino_t ino, int type) if (compare_ignore_not_found) break; fprintf(stderr, "%s: (inode %lu) not found on tape\n", name, (unsigned long)ino); + compare_errors = 1; break; /* @@ -614,8 +616,10 @@ removeoldnodes(void) static void compare_entry(struct entry *ep, int do_compare) { - if ((ep->e_flags & (NEW|EXTRACT)) == 0) + if ((ep->e_flags & (NEW|EXTRACT)) == 0) { badentry(ep, "unexpected file on tape"); + compare_errors = 1; + } if (do_compare) (void) comparefile(myname(ep)); ep->e_flags &= ~(NEW|EXTRACT); } @@ -646,6 +650,7 @@ compareleaves(void) if (ep == NULL) panic("%d: bad first\n", first); fprintf(stderr, "%s: not found on tape\n", myname(ep)); + compare_errors = 1; ep->e_flags &= ~(NEW|EXTRACT); first = lowerbnd(first); } @@ -659,12 +664,15 @@ compareleaves(void) if (first != curfile.ino) { fprintf(stderr, "expected next file %ld, got %lu\n", (long)first, (unsigned long)curfile.ino); + compare_errors = 1; skipfile(); goto next; } ep = lookupino(curfile.ino); - if (ep == NULL) + if (ep == NULL) { panic("unknown file on tape\n"); + compare_errors = 1; + } compare_entry(ep, 1); for (ep = ep->e_links; ep != NULL; ep = ep->e_links) { compare_entry(ep, 0);