From c60338a56124b7cef872965711e81af4b396d28e Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Tue, 8 Feb 2000 12:22:42 +0000 Subject: [PATCH] Problem when restoring a hard link to an inode having the immutable or append-only flag set. --- CHANGES | 6 +++++- restore/extern.h | 3 ++- restore/utilities.c | 14 +++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 836a8f7..5f45d06 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.40 2000/02/04 20:57:31 stelian Exp $ +$Id: CHANGES,v 1.41 2000/02/08 12:22:42 stelian Exp $ Changes between versions 0.4b13 and 0.4b14 (released ????????????????) ====================================================================== @@ -24,6 +24,10 @@ Changes between versions 0.4b13 and 0.4b14 (released ????????????????) 5. Added a REPORTING-BUGS file in order to provide a guide on how to correctly report a bug in dump/restore. +6. Fixed a restore problem when restoring a hard link to an inode + having the immutable or append-only attribute set. Thanks to + Ambrose Li for submitting the patch. + Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000) ====================================================================== diff --git a/restore/extern.h b/restore/extern.h index d695677..dfbe5fe 100644 --- a/restore/extern.h +++ b/restore/extern.h @@ -4,7 +4,7 @@ * Remy Card , 1994-1997 * Stelian Pop , 1999-2000 * - * $Id: extern.h,v 1.7 2000/01/21 10:17:41 stelian Exp $ + * $Id: extern.h,v 1.8 2000/02/08 12:22:43 stelian Exp $ */ /*- @@ -120,4 +120,5 @@ int rmtseek __P((int, int)); /* From e2fsprogs */ int fsetflags __P((const char *, unsigned long)); +int fgetflags __P((const char *, unsigned long *)); int setflags __P((int, unsigned long)); diff --git a/restore/utilities.c b/restore/utilities.c index 02c3793..f052071 100644 --- a/restore/utilities.c +++ b/restore/utilities.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: utilities.c,v 1.7 2000/01/21 10:17:41 stelian Exp $"; + "$Id: utilities.c,v 1.8 2000/02/08 12:22:43 stelian Exp $"; #endif /* not lint */ #include @@ -244,6 +244,18 @@ linkit(char *existing, char *new, int type) ret = link(existing, new); chflags(existing, s.st_flags); } +#else + unsigned long s; + + /* + * Most likely, the immutable or append-only attribute + * is set. Clear the attributes and try again. + */ + if (fgetflags (existing, &s) != -1 && + fsetflags (existing, 0) != -1) { + ret = link(existing, new); + fsetflags(existing, s); + } #endif if (ret < 0) { warn("warning: cannot create hard link %s->%s", -- 2.39.5