mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-23 18:25:19 +00:00
correct usage of cleanup() everywhere - this became bogus when the warnx/errx
stuff was added and nobody seems to have noticed. :) Noticed by: Josh MacDonald <jmacd@paris.CS.Berkeley.EDU>
This commit is contained in:
parent
f7fb3ee05b
commit
375ca45770
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39068
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: extract.c,v 1.19 1998/01/21 00:12:56 imp Exp $";
|
||||
"$Id: extract.c,v 1.20 1998/07/04 14:13:01 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -36,9 +36,11 @@ static const char rcsid[] =
|
|||
if (where_count > sizeof(STARTSTRING)-1) { \
|
||||
strcat(where_args, "|tar xf - -C "); \
|
||||
strcat(where_args, todir); \
|
||||
if (system(where_args)) \
|
||||
cleanup(0), errx(2, "can not invoke %d byte tar pipeline: %s", \
|
||||
strlen(where_args), where_args); \
|
||||
if (system(where_args)) { \
|
||||
cleanup(0); \
|
||||
errx(2, "can not invoke %d byte tar pipeline: %s", \
|
||||
strlen(where_args), where_args); \
|
||||
} \
|
||||
strcpy(where_args, STARTSTRING); \
|
||||
where_count = sizeof(STARTSTRING)-1; \
|
||||
} \
|
||||
|
@ -85,11 +87,15 @@ extract_plist(char *home, Package *pkg)
|
|||
|
||||
maxargs = sysconf(_SC_ARG_MAX) / 2; /* Just use half the argument space */
|
||||
where_args = alloca(maxargs);
|
||||
if (!where_args)
|
||||
cleanup(0), errx(2, "can't get argument list space");
|
||||
if (!where_args) {
|
||||
cleanup(0);
|
||||
errx(2, "can't get argument list space");
|
||||
}
|
||||
perm_args = alloca(maxargs);
|
||||
if (!perm_args)
|
||||
cleanup(0), errx(2, "can't get argument list space");
|
||||
if (!perm_args) {
|
||||
cleanup(0);
|
||||
errx(2, "can't get argument list space");
|
||||
}
|
||||
|
||||
strcpy(where_args, STARTSTRING);
|
||||
where_count = sizeof(STARTSTRING)-1;
|
||||
|
@ -123,8 +129,10 @@ 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);
|
||||
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);
|
||||
|
@ -150,8 +158,10 @@ extract_plist(char *home, Package *pkg)
|
|||
PUSHOUT(Directory);
|
||||
}
|
||||
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!");
|
||||
if (add_count > maxargs - perm_count) {
|
||||
cleanup(0);
|
||||
errx(2, "oops, miscounted strings!");
|
||||
}
|
||||
perm_count += add_count;
|
||||
}
|
||||
else {
|
||||
|
@ -168,14 +178,18 @@ extract_plist(char *home, Package *pkg)
|
|||
PUSHOUT(Directory);
|
||||
}
|
||||
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!");
|
||||
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);
|
||||
if (add_count > maxargs - perm_count)
|
||||
cleanup(0), errx(2, "oops, miscounted strings!");
|
||||
if (add_count > maxargs - perm_count) {
|
||||
cleanup(0);
|
||||
errx(2, "oops, miscounted strings!");
|
||||
}
|
||||
perm_count += add_count;
|
||||
}
|
||||
}
|
||||
|
@ -186,9 +200,10 @@ extract_plist(char *home, Package *pkg)
|
|||
printf("extract: CWD to %s\n", p->name);
|
||||
PUSHOUT(Directory);
|
||||
if (strcmp(p->name, ".")) {
|
||||
if (!Fake && make_hierarchy(p->name) == FAIL)
|
||||
cleanup(0), errx(2, "unable to make directory '%s'",
|
||||
p->name);
|
||||
if (!Fake && make_hierarchy(p->name) == FAIL) {
|
||||
cleanup(0);
|
||||
errx(2, "unable to make directory '%s'", p->name);
|
||||
}
|
||||
Directory = p->name;
|
||||
}
|
||||
else
|
||||
|
@ -197,12 +212,14 @@ extract_plist(char *home, Package *pkg)
|
|||
|
||||
case PLIST_CMD:
|
||||
if ((strstr(p->name, "%B") || strstr(p->name, "%F") ||
|
||||
strstr(p->name, "%f")) && last_file == NULL)
|
||||
cleanup(0), errx(2, "no last file specified for '%s' command",
|
||||
p->name);
|
||||
if (strstr(p->name, "%D") && Directory == NULL)
|
||||
cleanup(0), errx(2, "no directory specified for '%s' command",
|
||||
p->name);
|
||||
strstr(p->name, "%f")) && last_file == NULL) {
|
||||
cleanup(0);
|
||||
errx(2, "no last file specified for '%s' command", p->name);
|
||||
}
|
||||
if (strstr(p->name, "%D") && Directory == NULL) {
|
||||
cleanup(0);
|
||||
errx(2, "no directory specified for '%s' command", p->name);
|
||||
}
|
||||
format_cmd(cmd, p->name, Directory, last_file);
|
||||
PUSHOUT(Directory);
|
||||
if (Verbose)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: perform.c,v 1.51 1998/08/27 14:59:55 jkh Exp $";
|
||||
"$Id: perform.c,v 1.52 1998/09/08 03:02:45 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -480,17 +480,18 @@ sanity_check(char *pkg)
|
|||
}
|
||||
|
||||
void
|
||||
cleanup(int signo)
|
||||
cleanup(int sig)
|
||||
{
|
||||
static int in_cleanup = 0;
|
||||
|
||||
if (!in_cleanup) {
|
||||
in_cleanup = 1;
|
||||
if (signo)
|
||||
printf("Signal %d received, cleaning up..\n", signo);
|
||||
if (sig)
|
||||
printf("Signal %d received, cleaning up..\n", sig);
|
||||
if (!Fake && zapLogDir && LogDir[0])
|
||||
vsystem("%s -rf %s", REMOVE_CMD, LogDir);
|
||||
vsystem("%s -rf %s", REMOVE_CMD, LogDir);
|
||||
leave_playpen();
|
||||
}
|
||||
exit(1);
|
||||
if (sig)
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: perform.c,v 1.43 1998/09/08 03:15:41 jkh Exp $";
|
||||
"$Id: perform.c,v 1.44 1998/09/08 10:42:24 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -56,9 +56,10 @@ pkg_perform(char **pkgs)
|
|||
pkg_in = stdin;
|
||||
else {
|
||||
pkg_in = fopen(Contents, "r");
|
||||
if (!pkg_in)
|
||||
cleanup(0), errx(2, "unable to open contents file '%s' for input",
|
||||
Contents);
|
||||
if (!pkg_in) {
|
||||
cleanup(0);
|
||||
errx(2, "unable to open contents file '%s' for input", Contents);
|
||||
}
|
||||
}
|
||||
plist.head = plist.tail = NULL;
|
||||
|
||||
|
@ -164,11 +165,15 @@ pkg_perform(char **pkgs)
|
|||
|
||||
/* Finally, write out the packing list */
|
||||
fp = fopen(CONTENTS_FNAME, "w");
|
||||
if (!fp)
|
||||
cleanup(0), errx(2, "can't open file %s for writing", CONTENTS_FNAME);
|
||||
if (!fp) {
|
||||
cleanup(0);
|
||||
errx(2, "can't open file %s for writing", CONTENTS_FNAME);
|
||||
}
|
||||
write_plist(&plist, fp);
|
||||
if (fclose(fp))
|
||||
cleanup(0), errx(2, "error while closing %s", CONTENTS_FNAME);
|
||||
if (fclose(fp)) {
|
||||
cleanup(0);
|
||||
errx(2, "error while closing %s", CONTENTS_FNAME);
|
||||
}
|
||||
|
||||
/* And stick it into a tar ball */
|
||||
make_dist(home, pkg, "tgz", &plist);
|
||||
|
@ -219,10 +224,14 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist)
|
|||
printf("Creating gzip'd tar ball in '%s'\n", tball);
|
||||
|
||||
/* Set up a pipe for passing the filenames, and fork off a tar process. */
|
||||
if (pipe(pipefds) == -1)
|
||||
cleanup(0), errx(2, "cannot create pipe");
|
||||
if ((pid = fork()) == -1)
|
||||
cleanup(0), errx(2, "cannot fork process for tar");
|
||||
if (pipe(pipefds) == -1) {
|
||||
cleanup(0);
|
||||
errx(2, "cannot create pipe");
|
||||
}
|
||||
if ((pid = fork()) == -1) {
|
||||
cleanup(0);
|
||||
errx(2, "cannot fork process for tar");
|
||||
}
|
||||
if (pid == 0) { /* The child */
|
||||
dup2(pipefds[0], 0);
|
||||
close(pipefds[0]);
|
||||
|
@ -234,8 +243,10 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist)
|
|||
|
||||
/* Meanwhile, back in the parent process ... */
|
||||
close(pipefds[0]);
|
||||
if ((totar = fdopen(pipefds[1], "w")) == NULL)
|
||||
cleanup(0), errx(2, "fdopen failed");
|
||||
if ((totar = fdopen(pipefds[1], "w")) == NULL) {
|
||||
cleanup(0);
|
||||
errx(2, "fdopen failed");
|
||||
}
|
||||
|
||||
fprintf(totar, "%s\n", CONTENTS_FNAME);
|
||||
fprintf(totar, "%s\n", COMMENT_FNAME);
|
||||
|
@ -264,22 +275,27 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist)
|
|||
fclose(totar);
|
||||
wait(&ret);
|
||||
/* assume either signal or bad exit is enough for us */
|
||||
if (ret)
|
||||
cleanup(0), errx(2, "tar command failed with code %d", ret);
|
||||
if (ret) {
|
||||
cleanup(0);
|
||||
errx(2, "tar command failed with code %d", ret);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sanity_check()
|
||||
{
|
||||
if (!Comment)
|
||||
cleanup(0), errx(2,
|
||||
"required package comment string is missing (-c comment)");
|
||||
if (!Desc)
|
||||
cleanup(0), errx(2,
|
||||
"required package description string is missing (-d desc)");
|
||||
if (!Contents)
|
||||
cleanup(0), errx(2,
|
||||
"required package contents list is missing (-f [-]file)");
|
||||
if (!Comment) {
|
||||
cleanup(0);
|
||||
errx(2, "required package comment string is missing (-c comment)");
|
||||
}
|
||||
if (!Desc) {
|
||||
cleanup(0);
|
||||
errx(2, "required package description string is missing (-d desc)");
|
||||
}
|
||||
if (!Contents) {
|
||||
cleanup(0);
|
||||
errx(2, "required package contents list is missing (-f [-]file)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: pl.c,v 1.10 1997/02/22 16:09:30 peter Exp $";
|
||||
"$Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -85,8 +85,10 @@ trylink(const char *from, const char *to)
|
|||
#define PUSHOUT() /* push out string */ \
|
||||
if (where_count > sizeof(STARTSTRING)-1) { \
|
||||
strcat(where_args, "|tar xpf -"); \
|
||||
if (system(where_args)) \
|
||||
cleanup(0), errx(2, "can't invoke tar pipeline"); \
|
||||
if (system(where_args)) { \
|
||||
cleanup(0); \
|
||||
errx(2, "can't invoke tar pipeline"); \
|
||||
} \
|
||||
memset(where_args, 0, maxargs); \
|
||||
last_chdir = NULL; \
|
||||
strcpy(where_args, STARTSTRING); \
|
||||
|
@ -112,8 +114,10 @@ copy_plist(char *home, Package *plist)
|
|||
maxargs -= 64; /* some slop for the tar cmd text,
|
||||
and sh -c */
|
||||
where_args = malloc(maxargs);
|
||||
if (!where_args)
|
||||
cleanup(0), errx(2, "can't get argument list space");
|
||||
if (!where_args) {
|
||||
cleanup(0);
|
||||
errx(2, "can't get argument list space");
|
||||
}
|
||||
|
||||
memset(where_args, 0, maxargs);
|
||||
strcpy(where_args, STARTSTRING);
|
||||
|
@ -173,8 +177,10 @@ copy_plist(char *home, Package *plist)
|
|||
p->name);
|
||||
last_chdir = home;
|
||||
}
|
||||
if (add_count > maxargs - where_count)
|
||||
cleanup(0), errx(2, "oops, miscounted strings!");
|
||||
if (add_count > maxargs - where_count) {
|
||||
cleanup(0);
|
||||
errx(2, "oops, miscounted strings!");
|
||||
}
|
||||
where_count += add_count;
|
||||
}
|
||||
/*
|
||||
|
@ -207,8 +213,10 @@ copy_plist(char *home, Package *plist)
|
|||
" -C %s %s",
|
||||
mythere ? mythere : where,
|
||||
p->name);
|
||||
if (add_count > maxargs - where_count)
|
||||
cleanup(0), errx(2, "oops, miscounted strings!");
|
||||
if (add_count > maxargs - where_count) {
|
||||
cleanup(0);
|
||||
errx(2, "oops, miscounted strings!");
|
||||
}
|
||||
where_count += add_count;
|
||||
last_chdir = (mythere ? mythere : where);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: perform.c,v 1.14 1997/10/08 07:46:52 charnier Exp $";
|
||||
"$Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -64,8 +64,10 @@ pkg_do(char *pkg)
|
|||
warnx("no such package '%s' installed", pkg);
|
||||
return 1;
|
||||
}
|
||||
if (!getcwd(home, FILENAME_MAX))
|
||||
cleanup(0), errx(2, "unable to get current working directory!");
|
||||
if (!getcwd(home, FILENAME_MAX)) {
|
||||
cleanup(0);
|
||||
errx(2, "unable to get current working directory!");
|
||||
}
|
||||
if (chdir(LogDir) == FAIL) {
|
||||
warnx("unable to change directory to %s! deinstall failed", LogDir);
|
||||
return 1;
|
||||
|
@ -125,8 +127,10 @@ pkg_do(char *pkg)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (chdir(home) == FAIL)
|
||||
cleanup(0), errx(2, "Toto! This doesn't look like Kansas anymore!");
|
||||
if (chdir(home) == FAIL) {
|
||||
cleanup(0);
|
||||
errx(2, "Toto! This doesn't look like Kansas anymore!");
|
||||
}
|
||||
if (!Fake) {
|
||||
/* Some packages aren't packed right, so we need to just ignore delete_package()'s status. Ugh! :-( */
|
||||
if (delete_package(FALSE, CleanDirs, &Plist) == FAIL)
|
||||
|
@ -153,16 +157,17 @@ pkg_do(char *pkg)
|
|||
static void
|
||||
sanity_check(char *pkg)
|
||||
{
|
||||
if (!fexists(CONTENTS_FNAME))
|
||||
cleanup(0), errx(2, "installed package %s has no %s file!",
|
||||
pkg, CONTENTS_FNAME);
|
||||
if (!fexists(CONTENTS_FNAME)) {
|
||||
cleanup(0);
|
||||
errx(2, "installed package %s has no %s file!", pkg, CONTENTS_FNAME);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cleanup(int sig)
|
||||
{
|
||||
/* Nothing to do */
|
||||
exit(1);
|
||||
if (sig)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp $";
|
||||
"$Id: perform.c,v 1.24 1998/02/16 17:16:38 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -207,5 +207,6 @@ cleanup(int sig)
|
|||
in_cleanup = 1;
|
||||
leave_playpen();
|
||||
}
|
||||
exit(1);
|
||||
if (sig)
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: file.c,v 1.30 1997/10/18 05:54:17 jkh Exp $";
|
||||
"$Id: file.c,v 1.31 1998/09/08 10:42:26 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -327,16 +327,22 @@ fileGetContents(char *fname)
|
|||
struct stat sb;
|
||||
int fd;
|
||||
|
||||
if (stat(fname, &sb) == FAIL)
|
||||
cleanup(0), errx(2, "can't stat '%s'", fname);
|
||||
if (stat(fname, &sb) == FAIL) {
|
||||
cleanup(0);
|
||||
errx(2, "can't stat '%s'", fname);
|
||||
}
|
||||
|
||||
contents = (char *)malloc(sb.st_size + 1);
|
||||
fd = open(fname, O_RDONLY, 0);
|
||||
if (fd == FAIL)
|
||||
cleanup(0), errx(2, "unable to open '%s' for reading", fname);
|
||||
if (read(fd, contents, sb.st_size) != sb.st_size)
|
||||
cleanup(0), errx(2, "short read on '%s' - did not get %qd bytes",
|
||||
fname, sb.st_size);
|
||||
if (fd == FAIL) {
|
||||
cleanup(0);
|
||||
errx(2, "unable to open '%s' for reading", fname);
|
||||
}
|
||||
if (read(fd, contents, sb.st_size) != sb.st_size) {
|
||||
cleanup(0);
|
||||
errx(2, "short read on '%s' - did not get %qd bytes",
|
||||
fname, sb.st_size);
|
||||
}
|
||||
close(fd);
|
||||
contents[sb.st_size] = '\0';
|
||||
return contents;
|
||||
|
@ -384,14 +390,19 @@ write_file(char *name, char *str)
|
|||
int len;
|
||||
|
||||
fp = fopen(name, "w");
|
||||
if (!fp)
|
||||
cleanup(0), errx(2, "cannot fopen '%s' for writing", name);
|
||||
if (!fp) {
|
||||
cleanup(0);
|
||||
errx(2, "cannot fopen '%s' for writing", name);
|
||||
}
|
||||
len = strlen(str);
|
||||
if (fwrite(str, 1, len, fp) != len)
|
||||
cleanup(0), errx(2, "short fwrite on '%s', tried to write %d bytes",
|
||||
name, len);
|
||||
if (fclose(fp))
|
||||
cleanup(0), errx(2, "failure to fclose '%s'", name);
|
||||
if (fwrite(str, 1, len, fp) != len) {
|
||||
cleanup(0);
|
||||
errx(2, "short fwrite on '%s', tried to write %d bytes", name, len);
|
||||
}
|
||||
if (fclose(fp)) {
|
||||
cleanup(0);
|
||||
errx(2, "failure to fclose '%s'", name);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -403,8 +414,10 @@ copy_file(char *dir, char *fname, char *to)
|
|||
snprintf(cmd, FILENAME_MAX, "cp -p -r %s %s", fname, to);
|
||||
else
|
||||
snprintf(cmd, FILENAME_MAX, "cp -p -r %s/%s %s", dir, fname, to);
|
||||
if (vsystem(cmd))
|
||||
cleanup(0), errx(2, "could not perform '%s'", cmd);
|
||||
if (vsystem(cmd)) {
|
||||
cleanup(0);
|
||||
errx(2, "could not perform '%s'", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -416,8 +429,10 @@ move_file(char *dir, char *fname, char *to)
|
|||
snprintf(cmd, FILENAME_MAX, "mv %s %s", fname, to);
|
||||
else
|
||||
snprintf(cmd, FILENAME_MAX, "mv %s/%s %s", dir, fname, to);
|
||||
if (vsystem(cmd))
|
||||
cleanup(0), errx(2, "could not perform '%s'", cmd);
|
||||
if (vsystem(cmd)) {
|
||||
cleanup(0);
|
||||
errx(2, "could not perform '%s'", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -446,8 +461,10 @@ copy_hierarchy(char *dir, char *fname, Boolean to)
|
|||
#ifdef DEBUG
|
||||
printf("Using '%s' to copy trees.\n", cmd);
|
||||
#endif
|
||||
if (system(cmd))
|
||||
cleanup(0), errx(2, "copy_file: could not perform '%s'", cmd);
|
||||
if (system(cmd)) {
|
||||
cleanup(0);
|
||||
errx(2, "copy_file: could not perform '%s'", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
/* Unpack a tar file */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: msg.c,v 1.9 1997/10/08 07:48:09 charnier Exp $";
|
||||
"$Id: msg.c,v 1.10 1997/10/13 15:03:55 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -31,8 +31,8 @@ static const char rcsid[] =
|
|||
void
|
||||
upchuck(const char *err)
|
||||
{
|
||||
warn("fatal error during execution: %s", err);
|
||||
cleanup(0);
|
||||
errx(1, "fatal error during execution: %s", err);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -53,8 +53,8 @@ y_or_n(Boolean def, const char *msg, ...)
|
|||
*/
|
||||
tty = fopen("/dev/tty", "r");
|
||||
if (!tty) {
|
||||
warnx("can't open /dev/tty!");
|
||||
cleanup(0);
|
||||
errx(2, "can't open /dev/tty!");
|
||||
}
|
||||
while (ch != 'Y' && ch != 'N') {
|
||||
vfprintf(stderr, msg, args);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: pen.c,v 1.28 1998/04/12 16:01:10 jkh Exp $";
|
||||
"$Id: pen.c,v 1.29 1998/07/28 01:18:02 nectar Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -129,8 +129,10 @@ make_playpen(char *pen, size_t sz)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (chdir(pen) == FAIL)
|
||||
cleanup(0), errx(2, "can't chdir to '%s'", pen);
|
||||
if (chdir(pen) == FAIL) {
|
||||
cleanup(0);
|
||||
errx(2, "can't chdir to '%s'", pen);
|
||||
}
|
||||
|
||||
if (PenLocation[0])
|
||||
pushPen(PenLocation);
|
||||
|
@ -148,8 +150,10 @@ leave_playpen()
|
|||
/* Don't interrupt while we're cleaning up */
|
||||
oldsig = signal(SIGINT, SIG_IGN);
|
||||
if (Previous[0]) {
|
||||
if (chdir(Previous) == FAIL)
|
||||
cleanup(0), errx(2, "can't chdir back to '%s'", Previous);
|
||||
if (chdir(Previous) == FAIL) {
|
||||
cleanup(0);
|
||||
errx(2, "can't chdir back to '%s'", Previous);
|
||||
}
|
||||
Previous[0] = '\0';
|
||||
}
|
||||
if (PenLocation[0]) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: plist.c,v 1.25 1998/07/18 22:19:11 hoek Exp $";
|
||||
"$Id: plist.c,v 1.26 1998/09/01 06:58:11 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -250,8 +250,10 @@ read_plist(Package *pkg, FILE *fp)
|
|||
cp = pline;
|
||||
if (pline[0] == CMD_CHAR) {
|
||||
cmd = plist_cmd(pline + 1, &cp);
|
||||
if (cmd == FAIL)
|
||||
cleanup(0), errx(2, "bad command '%s'", pline);
|
||||
if (cmd == FAIL) {
|
||||
cleanup(0);
|
||||
errx(2, "bad command '%s'", pline);
|
||||
}
|
||||
if (*cp == '\0')
|
||||
cp = NULL;
|
||||
}
|
||||
|
@ -388,7 +390,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, Package *pkg)
|
|||
case PLIST_FILE:
|
||||
last_file = p->name;
|
||||
sprintf(tmp, "%s/%s", Where, p->name);
|
||||
if (isdir(tmp)) {
|
||||
if (isdir(tmp) && fexists(tmp)) {
|
||||
warnx("cannot delete specified file `%s' - it is a directory!\n"
|
||||
"this packing list is incorrect - ignoring delete request", tmp);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue