From 0deda9612a305c4187c8cdba17e033ff6cc4522a Mon Sep 17 00:00:00 2001 From: christos Date: Wed, 16 Jun 2004 14:26:24 +0000 Subject: [PATCH] PR/25934: Dieter Baron: hard links with long names still fail. As mentioned in the previous commit, the switch statement in the longlink() needed simplification and it was a bit incorrect. Only depend on the passed type to determine what kind of gnu longlink to produce. Don't try to deduce it from the archive file type. --- bin/pax/tar.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/pax/tar.c b/bin/pax/tar.c index 2524cc3cdb86..b2b733899d95 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -1,4 +1,4 @@ -/* $NetBSD: tar.c,v 1.55 2004/06/15 21:52:00 christos Exp $ */ +/* $NetBSD: tar.c,v 1.56 2004/06/16 14:26:24 christos Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: tar.c,v 1.55 2004/06/15 21:52:00 christos Exp $"); +__RCSID("$NetBSD: tar.c,v 1.56 2004/06/16 14:26:24 christos Exp $"); #endif #endif /* not lint */ @@ -969,24 +969,24 @@ longlink(ARCHD *arcn, int type) { ARCHD larc; - memset(&larc, 0, sizeof(larc)); + (void)memset(&larc, 0, sizeof(larc)); - switch (arcn->type) { - case PAX_SLK: - case PAX_HRG: - case PAX_HLK: - larc.type = type; - larc.nlen = strlcpy(larc.name, LONG_LINK, - sizeof(larc.ln_name)); + larc.type = type; + larc.nlen = strlcpy(larc.name, LONG_LINK, sizeof(larc.name)); + + switch (type) { + case PAX_GLL: gnu_hack_string = arcn->ln_name; gnu_hack_len = arcn->ln_nlen + 1; break; - default: - larc.type = type; - larc.nlen = strlcpy(larc.name, LONG_LINK, sizeof(larc.name)); + case PAX_GLF: gnu_hack_string = arcn->name; gnu_hack_len = arcn->nlen + 1; + break; + default: + errx(1, "Invalid type in GNU longlink %d\n", type); } + /* * We need a longlink now. */