X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=restore%2Ftape.c;h=3dc8bbaf7feb89560c699b8bb7d95b9f4439fa45;hb=7af2fada292acbfb50d441c4be192690dff40283;hp=3d673b62b740c9c1057e70a2ef6c3d0cd9dec469;hpb=db80efa5e8003ae2458073e328260d23aa603bcf;p=dump.git diff --git a/restore/tape.c b/restore/tape.c index 3d673b6..3dc8bba 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.92 2007/02/22 20:16:23 stelian Exp $"; + "$Id: tape.c,v 1.96 2010/03/22 15:40:55 stelian Exp $"; #endif /* not lint */ #include @@ -474,7 +474,6 @@ getvol(long nextvol) if (nextvol == 1) { tapesread = 0; gettingfile = 0; - tpblksread = 0; blksread = 0; } if (pipein) { @@ -892,21 +891,23 @@ extractfile(struct entry *ep, int doremove) } case IFIFO: + { + uid_t luid = curfile.dip->di_uid; + gid_t lgid = curfile.dip->di_gid; + 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) chown(name, luid, lgid); (void) chmod(name, mode); extractattr(name); utimes(name, timep); @@ -923,26 +924,28 @@ extractfile(struct entry *ep, int doremove) (void) chflags(name, flags); #endif #endif - skipfile(); return (GOOD); - + } case IFCHR: case IFBLK: + { + uid_t luid = curfile.dip->di_uid; + gid_t lgid = curfile.dip->di_gid; + int lrdev = (int)curfile.dip->di_rdev; + 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) { + if (mknod(name, mode, lrdev) < 0) { warn("%s: cannot create special file", name); - skipfile(); return (FAIL); } } - (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid); + (void) chown(name, luid, lgid); (void) chmod(name, mode); extractattr(name); utimes(name, timep); @@ -965,9 +968,8 @@ extractfile(struct entry *ep, int doremove) } #endif #endif - skipfile(); return (GOOD); - + } case IFREG: { uid_t luid = curfile.dip->di_uid; @@ -1236,12 +1238,20 @@ readxattr(char *buffer) skipfile(); return (FAIL); } - + memset(xattrbuf, 0, XATTR_MAXSIZE); xattrlen = 0; + /* + * ugly hack: cope with invalid spcl.c_addr[] records written by + * old versions of dump. + */ + readmapflag = 1; + getfile(xtrxattr, xtrnull); + readmapflag = 0; + memcpy(buffer, xattrbuf, XATTR_MAXSIZE); return (GOOD); @@ -1333,7 +1343,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,