]> git.wh0rd.org - dump.git/blobdiff - restore/restore.c
In restore -C, encountering an unexpected file is not an error.
[dump.git] / restore / restore.c
index e8b9027bee6a4df93c1ddb1642d9030eb9422122..c87b532d39cfc9046650febb5195e17400a2b4ef 100644 (file)
@@ -37,7 +37,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: restore.c,v 1.34 2004/12/14 14:07:57 stelian Exp $";
+       "$Id: restore.c,v 1.38 2008/04/17 15:22:56 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -581,7 +581,7 @@ findunreflinks(void)
                        continue;
                if (ep->e_entries == NULL)
                        continue;
-               for (j = 0; j < DIRHASH_SIZE; j++) {
+               for (j = 0; j < dirhash_size; j++) {
                        for (np = ep->e_entries[j]; np != NULL; np = np->e_sibling) {
                                if (np->e_flags == 0) {
                                        Dprintf(stdout,
@@ -599,7 +599,7 @@ findunreflinks(void)
        for (ep = removelist; ep != NULL; ep = ep->e_next) {
                if (ep->e_entries == NULL)
                        continue;
-               for (j = 0; j < DIRHASH_SIZE; j++) {
+               for (j = 0; j < dirhash_size; j++) {
                        for (np = ep->e_entries[j]; np != NULL; np = np->e_sibling) {
                                if (np->e_type == LEAF) {
                                        if (np->e_flags != 0)
@@ -635,15 +635,19 @@ removeoldnodes(void)
                change = 0;
                prev = &removelist;
                for (ep = removelist; ep != NULL; ep = *prev) {
+                       int docont = 0;
                        if (ep->e_entries != NULL) {
                                int i;
-                               for (i = 0; i < DIRHASH_SIZE; i++) {
+                               for (i = 0; i < dirhash_size; i++) {
                                        if (ep->e_entries[i] != NULL) {
                                                prev = &ep->e_next;
-                                               continue;
+                                               docont = 1;
+                                               break;
                                        }
                                }
                        }
+                       if (docont)
+                               continue;
                        *prev = ep->e_next;
                        removenode(ep);
                        freeentry(ep);
@@ -665,7 +669,10 @@ compare_entry(struct entry *ep, int do_compare)
                badentry(ep, "unexpected file on tape");
                do_compare_error;
        }
-       if (do_compare) (void) comparefile(myname(ep));
+       if (do_compare) {
+               (void) comparefile(myname(ep));
+               skipxattr();
+       }
        ep->e_flags &= ~(NEW|EXTRACT);
 }
 
@@ -709,7 +716,6 @@ compareleaves(void)
                if (first != curfile.ino) {
                        fprintf(stderr, "expected next file %ld, got %lu\n",
                                (long)first, (unsigned long)curfile.ino);
-                       do_compare_error;
                        skipfile();
                        goto next;
                }
@@ -821,39 +827,9 @@ createleaves(char *symtabfile)
                else
                        doremove = 0;
                (void) extractfile(ep, doremove);
+               skipxattr();
                ep->e_flags &= ~(NEW|EXTRACT);
 
-finderres:
-               if ((first == curfile.ino) && (spcl.c_flags & DR_EXTATTRIBUTES)) {
-                       switch (spcl.c_extattributes) {
-                       case EXT_MACOSFNDRINFO:
-#ifdef DUMP_MACOSX
-                               (void)extractfinderinfoufs(myname(ep));
-#else
-                               msg("MacOSX not supported in this version, skipping\n");
-                               skipfile();
-#endif
-                               break;
-                       case EXT_MACOSRESFORK:
-#ifdef DUMP_MACOSX
-                               (void)extractresourceufs(myname(ep));
-#else
-                               msg("MacOSX not supported in this version, skipping\n");
-                               skipfile();
-#endif
-                               break;
-                       case EXT_ACL:
-                               msg("ACLs not supported in this version, skipping\n");
-                               skipfile();
-                               break;
-                       default:
-                               msg("unexpected inode extension %ld, skipping\n", spcl.c_extattributes);
-                               skipfile();
-                               break;
-                       }
-                       goto finderres;
-               }
-
                /*
                 * We checkpoint the restore after every tape reel, so
                 * as to simplify the amount of work required by the
@@ -1084,37 +1060,7 @@ createfiles(void)
                        } else {
 #endif /* USE_QFA */
                                (void) extractfile(ep, 0);
-
-finderres:
-                               if ((next == curfile.ino) && (spcl.c_flags & DR_EXTATTRIBUTES)) {
-                                       switch (spcl.c_extattributes) {
-                                       case EXT_MACOSFNDRINFO:
-#ifdef DUMP_MACOSX
-                                               (void)extractfinderinfoufs(myname(ep));
-#else
-                                               msg("MacOSX not supported in this version, skipping\n");
-                                               skipfile();
-#endif
-                                               break;
-                                       case EXT_MACOSRESFORK:
-#ifdef DUMP_MACOSX
-                                               (void)extractresourceufs(myname(ep));
-#else
-                                               msg("MacOSX not supported in this version, skipping\n");
-                                               skipfile();
-#endif
-                                               break;
-                                       case EXT_ACL:
-                                               msg("ACLs not supported in this version, skipping\n");
-                                               skipfile();
-                                               break;
-                                       default:
-                                               msg("unexpected inode extension %ld, skipping\n", spcl.c_extattributes);
-                                               skipfile();
-                                               break;
-                                       }
-                                       goto finderres;
-                               }
+                               skipxattr();
 
 #ifdef USE_QFA
                        }