X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=restore%2Futilities.c;h=c6168724d95e65c1eea2e9d8867a102f41ce0198;hb=d6967896bc4e18f9b4359a2ef5be5c0f1bcc456a;hp=1498599166bbe4b48e904839c7af3c14e7997a37;hpb=8d4197bb9ba5bbcef21409231ed8903b0cac353a;p=dump.git diff --git a/restore/utilities.c b/restore/utilities.c index 1498599..c616872 100644 --- a/restore/utilities.c +++ b/restore/utilities.c @@ -2,8 +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,13 +40,11 @@ */ #ifndef lint -#if 0 -static char sccsid[] = "@(#)utilities.c 8.5 (Berkeley) 4/28/95"; -#endif static const char rcsid[] = - "$Id: utilities.c,v 1.4 1999/10/11 13:08:10 stelian Exp $"; + "$Id: utilities.c,v 1.11 2000/12/21 11:14:54 stelian Exp $"; #endif /* not lint */ +#include #include #include @@ -248,6 +246,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",