diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c index 0baed7871a0e..226ece87b6dc 100644 --- a/usr.sbin/pkg_install/add/extract.c +++ b/usr.sbin/pkg_install/add/extract.c @@ -1,11 +1,11 @@ -/* $NetBSD: extract.c,v 1.16 1999/03/12 17:32:20 tron Exp $ */ +/* $NetBSD: extract.c,v 1.17 1999/05/29 20:44:20 christos Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp"; #else -__RCSID("$NetBSD: extract.c,v 1.16 1999/03/12 17:32:20 tron Exp $"); +__RCSID("$NetBSD: extract.c,v 1.17 1999/05/29 20:44:20 christos Exp $"); #endif #endif @@ -69,7 +69,10 @@ rollback(char *name, char *home, plist_t *start, plist_t *stop) dir = home; for (q = start; q != stop; q = q->next) { if (q->type == PLIST_FILE) { - snprintf(try, FILENAME_MAX, "%s/%s", dir, q->name); + if (q->name[0] == '/') + snprintf(try, FILENAME_MAX, "%s", q->name); + else + snprintf(try, FILENAME_MAX, "%s/%s", dir, q->name); if (make_preserve_name(bup, FILENAME_MAX, name, try) && fexists(bup)) { (void)chflags(try, 0); (void)unlink(try); @@ -140,8 +143,12 @@ extract_plist(char *home, package_t *pkg) case PLIST_FILE: last_file = p->name; - if (Verbose) - printf("extract: %s/%s\n", Directory, p->name); + if (Verbose) { + if (p->name[0] == '/') + printf("extract: %s\n", p->name); + else + printf("extract: %s/%s\n", Directory, p->name); + } if (!Fake) { char try[FILENAME_MAX]; @@ -151,7 +158,10 @@ extract_plist(char *home, package_t *pkg) } /* first try to rename it into place */ - snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name); + if (p->name[0] == '/') + snprintf(try, FILENAME_MAX, "%s", p->name); + else + snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name); if (fexists(try)) { (void)chflags(try, 0); /* XXX hack - if truly immutable, rename fails */ if (preserve && PkgName) { diff --git a/usr.sbin/pkg_install/admin/main.c b/usr.sbin/pkg_install/admin/main.c index 490fc3d95575..31012be7e036 100644 --- a/usr.sbin/pkg_install/admin/main.c +++ b/usr.sbin/pkg_install/admin/main.c @@ -1,8 +1,8 @@ -/* $NetBSD: main.c,v 1.3 1999/03/22 05:02:40 hubertf Exp $ */ +/* $NetBSD: main.c,v 1.4 1999/05/29 20:44:21 christos Exp $ */ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.3 1999/03/22 05:02:40 hubertf Exp $"); +__RCSID("$NetBSD: main.c,v 1.4 1999/05/29 20:44:21 christos Exp $"); #endif /* @@ -84,7 +84,10 @@ static void check1pkg(const char *pkgdir) abort(); } - snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name); + if (p->name[0] == '/') + snprintf(file, FILENAME_MAX, "%s", p->name); + else + snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name); if (!isfile(file)) warnx("%s: File %s is in %s but not on filesystem!", PkgName, file, CONTENTS_FNAME); @@ -208,7 +211,10 @@ static void rebuild(void) abort(); } - snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name); + if (p->name[0] == '/') + snprintf(file, FILENAME_MAX, "%s", p->name); + else + snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name); if (!isfile(file)) warnx("%s: File %s is in %s but not on filesystem!", diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c index edbf8beb9e80..568c4201db52 100644 --- a/usr.sbin/pkg_install/create/pl.c +++ b/usr.sbin/pkg_install/create/pl.c @@ -1,11 +1,11 @@ -/* $NetBSD: pl.c,v 1.11 1999/03/02 10:32:23 agc Exp $ */ +/* $NetBSD: pl.c,v 1.12 1999/05/29 20:44:21 christos Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp"; #else -__RCSID("$NetBSD: pl.c,v 1.11 1999/03/02 10:32:23 agc Exp $"); +__RCSID("$NetBSD: pl.c,v 1.12 1999/05/29 20:44:21 christos Exp $"); #endif #endif @@ -163,7 +163,12 @@ check_list(char *home, package_t *pkg, const char *PkgName) } } - (void) snprintf(name, sizeof(name), "%s/%s", srcdir ? srcdir : cwd, p->name); + if (p->name[0] == '/') + (void) snprintf(name, sizeof(name), "%s", + p->name); + else + (void) snprintf(name, sizeof(name), "%s/%s", + srcdir ? srcdir : cwd, p->name); if (lstat(name, &st) < 0) { warnx("can't stat `%s'", name); continue; diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index 009c3ea43cc8..cf40a27ccf36 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -1,11 +1,11 @@ -/* $NetBSD: show.c,v 1.13 1999/05/15 03:27:50 hubertf Exp $ */ +/* $NetBSD: show.c,v 1.14 1999/05/29 20:44:22 christos Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp"; #else -__RCSID("$NetBSD: show.c,v 1.13 1999/05/15 03:27:50 hubertf Exp $"); +__RCSID("$NetBSD: show.c,v 1.14 1999/05/29 20:44:22 christos Exp $"); #endif #endif @@ -213,7 +213,10 @@ show_files(char *title, package_t *plist) switch(p->type) { case PLIST_FILE: if (!ign) { - printf("%s/%s\n", dir, p->name); + if (p->name[0] == '/') + printf("%s\n", p->name); + else + printf("%s/%s\n", dir, p->name); } ign = FALSE; break; diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index 952eeb172fed..0ad2a01c6fa6 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -1,11 +1,11 @@ -/* $NetBSD: plist.c,v 1.18 1999/03/15 08:57:12 christos Exp $ */ +/* $NetBSD: plist.c,v 1.19 1999/05/29 20:44:22 christos Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp"; #else -__RCSID("$NetBSD: plist.c,v 1.18 1999/03/15 08:57:12 christos Exp $"); +__RCSID("$NetBSD: plist.c,v 1.19 1999/05/29 20:44:22 christos Exp $"); #endif #endif @@ -339,7 +339,10 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg) case PLIST_FILE: last_file = p->name; - (void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name); + if (p->name[0] == '/') + (void) snprintf(tmp, sizeof(tmp), p->name); + else + (void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name); if (isdir(tmp)) { warnx("attempting to delete directory `%s' as a file\n" "this packing list is incorrect - ignoring delete request", tmp);