X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=restore%2Futilities.c;h=f052071484824a7fc41db11ad265f0e90507c728;hb=d339304329df2d458e54c02eac10a27cb31d9cb1;hp=44cea0454c343c9d513b72da27444320384eb3ca;hpb=ec387a1267f4cac7625cd5b6d1c1f080d39085b3;p=dump.git diff --git a/restore/utilities.c b/restore/utilities.c index 44cea04..f052071 100644 --- a/restore/utilities.c +++ b/restore/utilities.c @@ -2,8 +2,7 @@ * 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 */ /* @@ -37,10 +36,13 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $Id: utilities.c,v 1.5 1999/10/11 13:31:14 stelian Exp $ */ +#ifndef lint +static const char rcsid[] = + "$Id: utilities.c,v 1.8 2000/02/08 12:22:43 stelian Exp $"; +#endif /* not lint */ + #include #include @@ -242,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",