X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=restore%2Futilities.c;h=a7164fb134697d34bd13231d9d7a6f8ae57e01ca;hb=43460f04f3920ae39f345a2fb39d000a890a4283;hp=de508cd26d92c378be4716b112ab7921927236ea;hpb=df9ae507502f413c72119dde6ea3d35c91dba5bf;p=dump.git diff --git a/restore/utilities.c b/restore/utilities.c index de508cd..a7164fb 100644 --- a/restore/utilities.c +++ b/restore/utilities.c @@ -2,7 +2,8 @@ * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit * Remy Card , 1994-1997 - * Stelian Pop , 1999 + * Stelian Pop , 1999-2000 + * Stelian Pop - AlcĂ´ve , 2000 */ /* @@ -40,31 +41,29 @@ #ifndef lint static const char rcsid[] = - "$Id: utilities.c,v 1.6 1999/10/13 09:57:21 stelian Exp $"; + "$Id: utilities.c,v 1.12 2001/03/19 13:22:49 stelian Exp $"; #endif /* not lint */ +#include +#include +#include +#include +#include +#include + #include #include #ifdef __linux__ #include #include +#include #include #else /* __linux__ */ #include #include #endif /* __linux__ */ -#include -#include -#include -#include -#include - -#ifdef __linux__ -#include -#endif - #include "restore.h" #include "extern.h" @@ -244,6 +243,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",