From db80efa5e8003ae2458073e328260d23aa603bcf Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Thu, 22 Feb 2007 20:16:23 +0000 Subject: [PATCH] Fix the EA set failures when restoring immutable files --- CHANGES | 5 ++++- restore/dirs.c | 10 +++++----- restore/tape.c | 16 ++++++++-------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 584f030..00b92f5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.285 2007/02/22 20:12:50 stelian Exp $ +$Id: CHANGES,v 1.286 2007/02/22 20:16:23 stelian Exp $ Changes between versions 0.4b41 and 0.4b42 (released xxxxxxxxxxxxxxx) ===================================================================== @@ -17,6 +17,9 @@ Changes between versions 0.4b41 and 0.4b42 (released xxxxxxxxxxxxxxx) (see http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=189845 for details) +4. Fix EA set failures when restoring immutable files. Thanks + to Andrew Kroeger for the patch. + Changes between versions 0.4b40 and 0.4b41 (released January 2, 2006) ===================================================================== diff --git a/restore/dirs.c b/restore/dirs.c index 88dfc69..509d35f 100644 --- a/restore/dirs.c +++ b/restore/dirs.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] = - "$Id: dirs.c,v 1.33 2005/05/28 18:34:47 stelian Exp $"; + "$Id: dirs.c,v 1.34 2007/02/22 20:16:23 stelian Exp $"; #endif /* not lint */ #include @@ -710,6 +710,10 @@ setdirmodes(int flags) cp = myname(ep); (void) chown(cp, node.uid, node.gid); (void) chmod(cp, node.mode); + utimes(cp, node.timep); + if (node.xattr) + xattr_extract(cp, xattr); + ep->e_flags &= ~NEW; if (node.flags) #ifdef __linux__ (void) lsetflags(cp, node.flags); @@ -719,10 +723,6 @@ setdirmodes(int flags) (void) chflags(cp, node.flags); #endif #endif - utimes(cp, node.timep); - if (node.xattr) - xattr_extract(cp, xattr); - ep->e_flags &= ~NEW; } } if (ferror(mf)) diff --git a/restore/tape.c b/restore/tape.c index 7378b20..3d673b6 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.91 2007/02/22 20:12:50 stelian Exp $"; + "$Id: tape.c,v 1.92 2007/02/22 20:16:23 stelian Exp $"; #endif /* not lint */ #include @@ -908,6 +908,8 @@ extractfile(struct entry *ep, int doremove) } (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); @@ -922,8 +924,6 @@ extractfile(struct entry *ep, int doremove) #endif #endif skipfile(); - extractattr(name); - utimes(name, timep); return (GOOD); case IFCHR: @@ -944,6 +944,8 @@ extractfile(struct entry *ep, int doremove) } (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid); (void) chmod(name, mode); + extractattr(name); + utimes(name, timep); if (flags) #ifdef __linux__ { @@ -964,8 +966,6 @@ extractfile(struct entry *ep, int doremove) #endif #endif skipfile(); - extractattr(name); - utimes(name, timep); return (GOOD); case IFREG: @@ -994,6 +994,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); @@ -1007,8 +1009,6 @@ extractfile(struct entry *ep, int doremove) (void) chflags(name, flags); #endif #endif - extractattr(name); - utimes(name, timep); return (GOOD); } } @@ -1216,8 +1216,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 */ -- 2.39.5