]> git.wh0rd.org - dump.git/commitdiff
Problem when restoring a hard link to an inode having the immutable
authorStelian Pop <stelian@popies.net>
Tue, 8 Feb 2000 12:22:42 +0000 (12:22 +0000)
committerStelian Pop <stelian@popies.net>
Tue, 8 Feb 2000 12:22:42 +0000 (12:22 +0000)
or append-only flag set.

CHANGES
restore/extern.h
restore/utilities.c

diff --git a/CHANGES b/CHANGES
index 836a8f764f06460155564997447edd57bea323e5..5f45d06617e570b429353356e1a6e5a80a1bbfc5 100644 (file)
--- 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 <acli@mingpaoxpress.com> for submitting the patch.
+
 Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000)
 ======================================================================
 
index d69567793c52a20ab6a9e382adaf6527238167fa..dfbe5fe8322c8edaff8a53682b56e46c510a8ca9 100644 (file)
@@ -4,7 +4,7 @@
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
  *     Stelian Pop <pop@cybercable.fr>, 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));
index 02c3793acdc61590e1d583eb53e2f2290906b737..f052071484824a7fc41db11ad265f0e90507c728 100644 (file)
@@ -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 <sys/param.h>
@@ -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",