summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJolan Luff <jolan@cvs.openbsd.org>2003-08-27 06:51:27 +0000
committerJolan Luff <jolan@cvs.openbsd.org>2003-08-27 06:51:27 +0000
commit877807e4c39ff15ee527ab49b4dd96eecd4148f8 (patch)
treef73aab49d82bc6f6057324f3cd8fa7613b16ea4d /usr.sbin
parent6057ce7e8d2da69cc18bd59e5de6dc40a16e711e (diff)
Avoid doing @cwd if no file follows. Patch from Pedro Bastos (based on
one from espie@) ok fgsch@ naddy@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_install/create/perform.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 79f1316fd37..83c2ddb3694 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: perform.c,v 1.16 2003/08/15 00:03:22 espie Exp $ */
+/* $OpenBSD: perform.c,v 1.17 2003/08/27 06:51:26 jolan Exp $ */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: perform.c,v 1.16 2003/08/15 00:03:22 espie Exp $";
+static const char rcsid[] = "$OpenBSD: perform.c,v 1.17 2003/08/27 06:51:26 jolan Exp $";
#endif
/*
@@ -280,6 +280,8 @@ make_dist(char *home, char *pkg, char *suffix, package_t *plist)
errx(2, "can't make temp file");
if (! (flist = fdopen(fd, "w")))
errx(2, "can't write to temp file");
+ if (strcmp(args[nargs], "-C") == 0)
+ nargs+= 2;
args[nargs++] = "-I";
args[nargs++] = tempfile[current++];
}
@@ -293,18 +295,17 @@ make_dist(char *home, char *pkg, char *suffix, package_t *plist)
if (flist)
fclose(flist);
flist = 0;
- args[nargs++] = "-C";
+ args[nargs] = "-C";
if (BaseDir) {
size_t size = strlen(BaseDir)+2+strlen(p->name);
- args[nargs] = malloc(size);
- if (!args[nargs]) {
+ args[nargs+1] = malloc(size);
+ if (args[nargs+1] == NULL) {
cleanup(0);
errx(2, "can't get Cwd space");
}
- snprintf(args[nargs], size, "%s/%s", BaseDir, p->name);
- nargs++;
+ snprintf(args[nargs+1], size, "%s/%s", BaseDir, p->name);
} else
- args[nargs++] = p->name;
+ args[nargs+1] = p->name;
}
else if (p->type == PLIST_IGNORE)
p = p->next;