]> git.wh0rd.org - dump.git/blobdiff - restore/tape.c
Fix restoration of extended attributes for fifos and device nodes.
[dump.git] / restore / tape.c
index c74e3909f10e46cf1f1ae026573f5d9cfab56bde..fa4a9618f3a8323ef7f5ea3ea0e18ab46c6dea57 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.90 2005/06/08 13:24:11 stelian Exp $";
+       "$Id: tape.c,v 1.94 2009/12/03 12:46:30 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -474,7 +474,6 @@ getvol(long nextvol)
        if (nextvol == 1) {
                tapesread = 0;
                gettingfile = 0;
-               tpblksread = 0;
                blksread = 0;
        }
        if (pipein) {
@@ -570,6 +569,8 @@ again:
        }
        if (haderror || (bot_code && !Mflag)) {
                haderror = 0;
+               if (compare_errors)
+                       fprintf(stderr, "%d compare errors so far\n", compare_errors);
 #ifdef sunos
                fprintf(stderr, "Mount volume %ld\n", (long)newvol);
 #else
@@ -891,21 +892,21 @@ extractfile(struct entry *ep, int doremove)
 
        case IFIFO:
                Vprintf(stdout, "extract fifo %s\n", name);
-               if (Nflag) {
-                       skipfile();
+               skipfile();
+               if (Nflag)
                        return (GOOD);
-               }
                if (! (spcl.c_flags & DR_METAONLY)) {
                        if (uflag && !Nflag)
                                (void)unlink(name);
                        if (mkfifo(name, mode) < 0) {
                                warn("%s: cannot create fifo", name);
-                               skipfile();
                                return (FAIL);
                        }
                }
                (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid);
                (void) chmod(name, mode);
+               extractattr(name);
+               utimes(name, timep);
                if (flags)
 #ifdef  __linux__
                        (void) lsetflags(name, flags);
@@ -919,29 +920,26 @@ extractfile(struct entry *ep, int doremove)
                        (void) chflags(name, flags);
 #endif
 #endif
-               skipfile();
-               extractattr(name);
-               utimes(name, timep);
                return (GOOD);
 
        case IFCHR:
        case IFBLK:
                Vprintf(stdout, "extract special file %s\n", name);
-               if (Nflag) {
-                       skipfile();
+               skipfile();
+               if (Nflag)
                        return (GOOD);
-               }
                if (! (spcl.c_flags & DR_METAONLY)) {
                        if (uflag)
                                (void)unlink(name);
                        if (mknod(name, mode, (int)curfile.dip->di_rdev) < 0) {
                                warn("%s: cannot create special file", name);
-                               skipfile();
                                return (FAIL);
                        }
                }
                (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid);
                (void) chmod(name, mode);
+               extractattr(name);
+               utimes(name, timep);
                if (flags)
 #ifdef __linux__
                        {
@@ -961,9 +959,6 @@ extractfile(struct entry *ep, int doremove)
                        }
 #endif
 #endif
-               skipfile();
-               extractattr(name);
-               utimes(name, timep);
                return (GOOD);
 
        case IFREG:
@@ -992,6 +987,8 @@ extractfile(struct entry *ep, int doremove)
                        skipfile();
                (void) chown(name, luid, lgid);
                (void) chmod(name, mode);
+               extractattr(name);
+               utimes(name, timep);
                if (flags)
 #ifdef __linux__
                        (void) lsetflags(name, flags);
@@ -1005,8 +1002,6 @@ extractfile(struct entry *ep, int doremove)
                        (void) chflags(name, flags);
 #endif
 #endif
-               extractattr(name);
-               utimes(name, timep);
                return (GOOD);
        }
        }
@@ -1214,8 +1209,8 @@ extractresourceufs(char *name)
                (void) fchown(ofile, uid, gid);
                (void) fchmod(ofile, mode);
                (void) close(ofile);
-               (void) lsetflags(oFileRsrc, flags);
                utimes(oFileRsrc, timep);
+               (void) lsetflags(oFileRsrc, flags);
                return (GOOD);
        }
        /* NOTREACHED */
@@ -1331,7 +1326,11 @@ loop:
                        break;
                }
        }
-       if (gethead(&spcl) == GOOD && size > 0) {
+       while (gethead(&spcl) != GOOD) {
+               fprintf(stderr, "Incorrect block for %s at %ld blocks\n",
+                       curfile.name, (long)blksread);
+       }
+       if (size > 0) {
                if (spcl.c_type == TS_ADDR)
                        goto loop;
                Dprintf(stdout,