Quote filenames more agressively.

Reviewed by:	jkh
Submitted by:	Hubert Feyrer
This commit is contained in:
Warner Losh 1998-01-21 00:12:56 +00:00
parent 49b239e0d2
commit 07d19529ee

View File

@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
"$Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp $";
"$Id: extract.c,v 1.18 1997/10/24 08:32:06 max Exp $";
#endif
/*
@ -123,6 +123,9 @@ extract_plist(char *home, Package *pkg)
if (!Fake) {
char try[FILENAME_MAX];
if (strrchr(p->name,'\''))
cleanup(0), errx(2, "Bogus filename \"%s\"", p->name);
/* first try to rename it into place */
snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name);
if (fexists(try)) {
@ -146,7 +149,7 @@ extract_plist(char *home, Package *pkg)
if (p->name[0] == '/' || TOOBIG(p->name)) {
PUSHOUT(Directory);
}
add_count = snprintf(&perm_args[perm_count], maxargs - perm_count, "%s ", p->name);
add_count = snprintf(&perm_args[perm_count], maxargs - perm_count, "'%s' ", p->name);
if (add_count > maxargs - perm_count)
cleanup(0), errx(2, "oops, miscounted strings!");
perm_count += add_count;
@ -160,13 +163,13 @@ extract_plist(char *home, Package *pkg)
else if (p->name[0] == '/' || TOOBIG(p->name)) {
PUSHOUT(Directory);
}
add_count = snprintf(&where_args[where_count], maxargs - where_count, " %s", p->name);
add_count = snprintf(&where_args[where_count], maxargs - where_count, " '%s'", p->name);
if (add_count > maxargs - where_count)
cleanup(0), errx(2, "oops, miscounted strings!");
where_count += add_count;
add_count = snprintf(&perm_args[perm_count],
maxargs - perm_count,
"%s ", p->name);
"'%s' ", p->name);
if (add_count > maxargs - perm_count)
cleanup(0), errx(2, "oops, miscounted strings!");
perm_count += add_count;