diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2001-04-08 16:45:49 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2001-04-08 16:45:49 +0000 |
commit | 5a14ac2a8fbdc64a6e5a1d31d891a4f0eee033d6 (patch) | |
tree | e31007d42dcc89fb9503a1c900c02a5f4ddcb019 | |
parent | 40d86c85d5851915c47abba5df4f515c693af109 (diff) |
Better error messages: pwarnx function, which works like pwarn, except
it shows a current package name along with the program name, e.g.,
pkg_add(foo-3.0): some error occurred.
A few messages now bear redundant pkgnames, which is much better than
doing pkg_add * and being informed that something went slightly wrong
somewhere...
-rw-r--r-- | usr.sbin/pkg_install/add/extract.c | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_install/add/futil.c | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_install/add/main.c | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_install/add/perform.c | 73 | ||||
-rw-r--r-- | usr.sbin/pkg_install/create/main.c | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_install/delete/main.c | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_install/delete/perform.c | 41 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/main.c | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/perform.c | 16 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/show.c | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/exec.c | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/lib.h | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/pen.c | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/plist.c | 24 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/pwarnx.c | 79 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/str.c | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_install/sign/pgp_check.c | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_install/sign/pgp_sign.c | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_install/sign/sha1.c | 14 |
21 files changed, 225 insertions, 138 deletions
diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c index 1e014a99912..f51fe8bc50b 100644 --- a/usr.sbin/pkg_install/add/extract.c +++ b/usr.sbin/pkg_install/add/extract.c @@ -1,7 +1,7 @@ -/* $OpenBSD: extract.c,v 1.11 2000/07/04 23:22:14 espie Exp $ */ +/* $OpenBSD: extract.c,v 1.12 2001/04/08 16:45:46 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: extract.c,v 1.11 2000/07/04 23:22:14 espie Exp $"; +static const char *rcsid = "$OpenBSD: extract.c,v 1.12 2001/04/08 16:45:46 espie Exp $"; #endif /* @@ -65,7 +65,7 @@ rollback(char *name, char *home, plist_t *start, plist_t *stop) (void)chflags(try, 0); (void)unlink(try); if (rename(bup, try)) - warnx("rollback: unable to rename %s back to %s", bup, try); + pwarnx("rollback: unable to rename %s back to %s", bup, try); } } else if (q->type == PLIST_CWD) { @@ -88,7 +88,7 @@ preserve(const char *fname) if (fexists(copy)) continue; if (rename(fname, copy) == 0) { - warnx("conflict: renamed existing %s to %s", fname, copy); + pwarnx("conflict: renamed existing %s to %s", fname, copy); return 0; } } @@ -154,7 +154,7 @@ extract_plist(char *home, package_t *pkg) snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name); if (fexists(try)) { if (preserve(try) == -1) { - warnx("unable to back up %s, aborting pkg_add", try); + pwarnx("unable to back up %s, aborting pkg_add", try); rollback(PkgName, home, pkg->head, p); return; } @@ -224,7 +224,7 @@ extract_plist(char *home, package_t *pkg) if (Verbose) printf("extract: execute '%s'\n", cmd); if (!Fake && system(cmd)) - warnx("command '%s' failed", cmd); + pwarnx("command '%s' failed", cmd); break; case PLIST_CHMOD: diff --git a/usr.sbin/pkg_install/add/futil.c b/usr.sbin/pkg_install/add/futil.c index 52a8e07dbdc..b58c316558d 100644 --- a/usr.sbin/pkg_install/add/futil.c +++ b/usr.sbin/pkg_install/add/futil.c @@ -1,7 +1,7 @@ -/* $OpenBSD: futil.c,v 1.5 1999/06/24 17:27:11 espie Exp $ */ +/* $OpenBSD: futil.c,v 1.6 2001/04/08 16:45:46 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: futil.c,v 1.5 1999/06/24 17:27:11 espie Exp $"; +static const char *rcsid = "$OpenBSD: futil.c,v 1.6 2001/04/08 16:45:46 espie Exp $"; #endif /* @@ -80,11 +80,11 @@ apply_perms(char *dir, char *arg) if (vsystem("cd %s && chown -R %s:%s %s", cd_to, real_owner , real_group, arg)) - warnx("couldn't change owner/group of '%s' to '%s:%s'", + pwarnx("couldn't change owner/group of '%s' to '%s:%s'", arg, real_owner, real_group); } if (Mode) if (vsystem("cd %s && chmod -R %s %s", cd_to, Mode, arg)) - warnx("couldn't change modes of '%s' to '%s'", arg, Mode); + pwarnx("couldn't change modes of '%s' to '%s'", arg, Mode); } diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 5559a3b3fc3..fc6eb94d2ff 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -1,7 +1,7 @@ -/* $OpenBSD: main.c,v 1.12 2000/02/04 05:05:45 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.13 2001/04/08 16:45:46 espie Exp $ */ #ifndef lint -static char *rcsid = "$OpenBSD: main.c,v 1.12 2000/02/04 05:05:45 deraadt Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.13 2001/04/08 16:45:46 espie Exp $"; #endif /* @@ -182,14 +182,14 @@ main(int argc, char **argv) } /* If no packages, yelp */ if (!ch) - warnx("missing package name(s)"), usage(); + pwarnx("missing package name(s)"), usage(); else if (ch > 1 && AddMode == MASTER) - warnx("only one package name may be specified with master mode"), + pwarnx("only one package name may be specified with master mode"), usage(); } if ((err = pkg_perform(pkgs)) != 0) { if (Verbose) - warnx("%d package addition(s) failed", err); + pwarnx("%d package addition(s) failed", err); return err; } else diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index 6313b62967d..466f1414b52 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -1,7 +1,7 @@ -/* $OpenBSD: perform.c,v 1.18 2001/04/02 10:13:38 espie Exp $ */ +/* $OpenBSD: perform.c,v 1.19 2001/04/08 16:45:46 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: perform.c,v 1.18 2001/04/02 10:13:38 espie Exp $"; +static const char *rcsid = "$OpenBSD: perform.c,v 1.19 2001/04/08 16:45:46 espie Exp $"; #endif /* @@ -85,6 +85,7 @@ pkg_do(char *pkg) plist_t *p; struct stat sb; + set_pkg(pkg); code = 0; zapLogDir = 0; LogDir[0] = '\0'; @@ -99,7 +100,7 @@ pkg_do(char *pkg) fgets(playpen, FILENAME_MAX, stdin); playpen[strlen(playpen) - 1] = '\0'; /* pesky newline! */ if (chdir(playpen) == FAIL) { - warnx("add in SLAVE mode can't chdir to `%s'", playpen); + pwarnx("add in SLAVE mode can't chdir to `%s'", playpen); return 1; } read_plist(&Plist, stdin); @@ -110,14 +111,14 @@ pkg_do(char *pkg) /* Is it an ftp://foo.bar.baz/file.tgz specification? */ if (isURL(pkg)) { if (ispkgpattern(pkg)) { - warnx("patterns not allowed in URLs, " + pwarnx("patterns not allowed in URLs, " "please install manually!"); /* ... until we come up with a better solution :-/ - HF */ goto bomb; } if (!(Home = fileGetURL(NULL, pkg))) { - warnx("unable to fetch `%s' by URL", pkg); + pwarnx("unable to fetch `%s' by URL", pkg); return 1; } where_to = Home; @@ -125,7 +126,7 @@ pkg_do(char *pkg) system(solve_deps); cfile = fopen(CONTENTS_FNAME, "r"); if (!cfile) { - warnx( + pwarnx( "unable to open table of contents file `%s' - not a package?", CONTENTS_FNAME); goto bomb; @@ -137,7 +138,7 @@ pkg_do(char *pkg) if (strcmp(pkg, "-")) { if (!ispkgpattern(pkg_fullname) && stat(pkg_fullname, &sb) == FAIL) { - warnx("can't stat package file '%s'", pkg_fullname); + pwarnx("can't stat package file '%s'", pkg_fullname); goto bomb; } snprintf(extract_contents, sizeof( extract_contents ), @@ -150,11 +151,11 @@ pkg_do(char *pkg) } Home = make_playpen(playpen, sizeof(playpen), sb.st_size * 4); if (!Home) - warnx("unable to make playpen for %ld bytes", + pwarnx("unable to make playpen for %ld bytes", (long)(sb.st_size * 4)); where_to = Home; if (unpack(pkg_fullname, extract)) { - warnx( + pwarnx( "unable to extract table of contents from `%s'\n" "Is this a Package, or a simple .tgz archive ? See tar(1).", pkg_fullname); @@ -163,7 +164,7 @@ pkg_do(char *pkg) system(solve_deps); cfile = fopen(CONTENTS_FNAME, "r"); if (!cfile) { - warnx( + pwarnx( "unable to open table of contents file `%s'\n" "Is this a Package, or a simple .tgz archive ? See tar(1).", CONTENTS_FNAME); @@ -181,11 +182,11 @@ pkg_do(char *pkg) */ if (!extract && min_free(playpen) < sb.st_size * 4) { - warnx("projected size of %ld exceeds available free space\n" + pwarnx("projected size of %ld exceeds available free space\n" "Please set your PKG_TMPDIR variable to point to a" "location with more\n" "free space and try again", (long)(sb.st_size * 4)); - warnx("not extracting `%s'\ninto `%s', sorry!", pkg_fullname, + pwarnx("not extracting `%s'\ninto `%s', sorry!", pkg_fullname, where_to); goto bomb; } @@ -193,7 +194,7 @@ pkg_do(char *pkg) /* Finally unpack the whole mess. If extract is null we already did so so don't bother doing it again. */ if (extract && unpack(pkg_fullname, NULL)) { - warnx("unable to extract `%s'!", pkg_fullname); + pwarnx("unable to extract `%s'!", pkg_fullname); goto bomb; } } /* isURL(pkg) */ @@ -226,7 +227,7 @@ pkg_do(char *pkg) /* See if we're already registered */ (void) snprintf(LogDir, sizeof(LogDir), "%s/%s", dbdir, PkgName); if ((isdir(LogDir) || islinktodir(LogDir)) && !Force) { - warnx("package `%s' already recorded as installed", PkgName); + pwarnx("package `%s' already recorded as installed", PkgName); code = 1; goto success; /* close enough for government work */ } @@ -251,9 +252,9 @@ pkg_do(char *pkg) strcpy(buf+(s-PkgName+1), isdigit(s[1]) ? "[0-9]*" : "*"); if (findmatchingname(dbdir, buf, check_if_installed, installed)) { - warnx("other version '%s' already installed", installed); + pwarnx("other version '%s' already installed", installed); if (find_plist_option(&Plist, "no-default-conflict") != NULL) { - warnx("proceeding with installation anyway"); + pwarnx("proceeding with installation anyway"); } else { code = 1; goto success; /* close enough for government work */ @@ -274,7 +275,7 @@ pkg_do(char *pkg) /* was: */ /* if (!vsystem("/usr/sbin/pkg_info -qe '%s'", p->name)) {*/ if(findmatchingname(dbdir, p->name, check_if_installed, installed)){ - warnx("Conflicting package installed, please use\n\t\"pkg_delete %s\" first to remove it!\n", installed); + pwarnx("Conflicting package installed, please use\n\t\"pkg_delete %s\" first to remove it!\n", installed); ++code; } } @@ -307,14 +308,14 @@ pkg_do(char *pkg) Prefix ? "-p " : "", Prefix ? Prefix : "", Verbose ? "-v " : "", cp)) { - warnx("autoload of dependency `%s' failed%s", + pwarnx("autoload of dependency `%s' failed%s", cp, Force ? " (proceeding anyway)" : "!"); if (!Force) ++code; } } else { - warnx("add of dependency `%s' failed%s", + pwarnx("add of dependency `%s' failed%s", p->name, Force ? " (proceeding anyway)" : "!"); if (!Force) ++code; @@ -323,7 +324,7 @@ pkg_do(char *pkg) /* install depending pkg via FTP */ if (ispkgpattern(p->name)){ - warnx("can't install dependent pkg '%s' via FTP, " + pwarnx("can't install dependent pkg '%s' via FTP, " "please install manually!", p->name); /* ... until we come up with a better solution - HF */ goto bomb; @@ -338,7 +339,7 @@ pkg_do(char *pkg) printf("Finished loading `%s' over FTP\n", p->name); system(solve_deps); if (!fexists(CONTENTS_FNAME)) { - warnx("autoloaded package `%s' has no %s file?", + pwarnx("autoloaded package `%s' has no %s file?", p->name, CONTENTS_FNAME); if (!Force) ++code; @@ -348,7 +349,7 @@ pkg_do(char *pkg) Prefix ? "-p " : "", Prefix ? Prefix : "", Verbose ? "-v " : "")) { - warnx("add of dependency `%s' failed%s", + pwarnx("add of dependency `%s' failed%s", p->name, Force ? " (proceeding anyway)" : "!"); if (!Force) ++code; @@ -385,7 +386,7 @@ pkg_do(char *pkg) if (Verbose) printf("Running requirements file first for `%s'\n", PkgName); if (!Fake && vsystem("./%s %s INSTALL", REQUIRE_FNAME, PkgName)) { - warnx("package `%s' fails requirements %s", pkg_fullname, + pwarnx("package `%s' fails requirements %s", pkg_fullname, Force ? "installing anyway" : "- not installed"); if (!Force) { code = 1; @@ -400,7 +401,7 @@ pkg_do(char *pkg) if (Verbose) printf("Running install with PRE-INSTALL for `%s'\n", PkgName); if (!Fake && vsystem("./%s %s PRE-INSTALL", INSTALL_FNAME, PkgName)) { - warnx("install script returned error status"); + pwarnx("install script returned error status"); unlink(INSTALL_FNAME); code = 1; goto success; /* nothing to uninstall yet */ @@ -420,7 +421,7 @@ pkg_do(char *pkg) if (vsystem("/usr/sbin/mtree -q -U -f %s -d -e -p %s", MTREE_FNAME, p ? p->name : "/")) - warnx("mtree returned a non-zero status - continuing"); + pwarnx("mtree returned a non-zero status - continuing"); } unlink(MTREE_FNAME); } @@ -430,7 +431,7 @@ pkg_do(char *pkg) if (Verbose) printf("Running install with POST-INSTALL for `%s'\n", PkgName); if (!Fake && vsystem("./%s %s POST-INSTALL", INSTALL_FNAME, PkgName)) { - warnx("install script returned error status"); + pwarnx("install script returned error status"); unlink(INSTALL_FNAME); code = 1; goto fail; @@ -445,9 +446,9 @@ pkg_do(char *pkg) umask(022); if (getuid() != 0) - warnx("not running as root - trying to record install anyway"); + pwarnx("not running as root - trying to record install anyway"); if (!PkgName) { - warnx("no package name! can't record package, sorry"); + pwarnx("no package name! can't record package, sorry"); code = 1; goto success; /* well, partial anyway */ } @@ -456,7 +457,7 @@ pkg_do(char *pkg) if (Verbose) printf("Attempting to record package into `%s'\n", LogDir); if (make_hierarchy(LogDir)) { - warnx("can't record package into '%s', you're on your own!", + pwarnx("can't record package into '%s', you're on your own!", LogDir); memset(LogDir, 0, FILENAME_MAX); code = 1; @@ -471,7 +472,7 @@ pkg_do(char *pkg) (void) snprintf(contents, sizeof(contents), "%s/%s", LogDir, CONTENTS_FNAME); cfile = fopen(contents, "w"); if (!cfile) { - warnx("can't open new contents file '%s'! can't register pkg", + pwarnx("can't open new contents file '%s'! can't register pkg", contents); goto success; /* can't log, but still keep pkg */ } @@ -511,12 +512,12 @@ pkg_do(char *pkg) cfile = fopen(contents, "a"); if (!cfile) - warnx("can't open dependency file '%s'!\n" + pwarnx("can't open dependency file '%s'!\n" "dependency registration is incomplete", contents); else { fprintf(cfile, "%s\n", PkgName); if (fclose(cfile) == EOF) - warnx("cannot properly close file `%s'", contents); + pwarnx("cannot properly close file `%s'", contents); } } if (Verbose) @@ -534,7 +535,7 @@ pkg_do(char *pkg) snprintf(buf, sizeof buf, "%s/%s", LogDir, p->name); if (stat(buf,&sbuf) == -1 || vsystem("%s %s", Pager, buf)) - warnx("cannot open `%s' as display file", buf); + pwarnx("cannot open `%s' as display file", buf); } goto success; @@ -561,15 +562,15 @@ sanity_check(char *pkg) int code = 0; if (!fexists(CONTENTS_FNAME)) { - warnx("package `%s' has no CONTENTS file!", pkg); + pwarnx("package `%s' has no CONTENTS file!", pkg); code = 1; } else if (!fexists(COMMENT_FNAME)) { - warnx("package `%s' has no COMMENT file!", pkg); + pwarnx("package `%s' has no COMMENT file!", pkg); code = 1; } else if (!fexists(DESC_FNAME)) { - warnx("package `%s' has no DESC file!", pkg); + pwarnx("package `%s' has no DESC file!", pkg); code = 1; } return code; diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c index c8d01e741f7..621bf09b71c 100644 --- a/usr.sbin/pkg_install/create/main.c +++ b/usr.sbin/pkg_install/create/main.c @@ -1,7 +1,7 @@ -/* $OpenBSD: main.c,v 1.8 1998/10/13 23:09:50 marc Exp $ */ +/* $OpenBSD: main.c,v 1.9 2001/04/08 16:45:46 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: main.c,v 1.8 1998/10/13 23:09:50 marc Exp $"; +static const char *rcsid = "$OpenBSD: main.c,v 1.9 2001/04/08 16:45:46 espie Exp $"; #endif /* @@ -137,14 +137,14 @@ main(int argc, char **argv) /* If no packages, yelp */ if (pkgs == start) - warnx("missing package name"), usage(); + pwarnx("missing package name"), usage(); *pkgs = NULL; if (start[1]) - warnx("only one package name allowed ('%s' extraneous)", start[1]), + pwarnx("only one package name allowed ('%s' extraneous)", start[1]), usage(); if (!pkg_perform(start)) { if (Verbose) - warnx("package creation failed"); + pwarnx("package creation failed"); return 1; } else diff --git a/usr.sbin/pkg_install/delete/main.c b/usr.sbin/pkg_install/delete/main.c index 6c889f9e44e..911f8ab936d 100644 --- a/usr.sbin/pkg_install/delete/main.c +++ b/usr.sbin/pkg_install/delete/main.c @@ -1,8 +1,8 @@ -/* $OpenBSD: main.c,v 1.7 1998/09/07 22:30:15 marc Exp $ */ +/* $OpenBSD: main.c,v 1.8 2001/04/08 16:45:47 espie Exp $ */ #include <sys/cdefs.h> #ifndef lint -static char *rcsid = "$OpenBSD: main.c,v 1.7 1998/09/07 22:30:15 marc Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.8 2001/04/08 16:45:47 espie Exp $"; #endif /* @@ -89,13 +89,13 @@ main(int argc, char **argv) /* If no packages, yelp */ if (pkgs == start) - warnx("missing package name(s)"), usage(); + pwarnx("missing package name(s)"), usage(); *pkgs = NULL; if (!Fake && getuid() != 0) errx(1, "you must be root to delete packages"); if ((error = pkg_perform(start)) != 0) { if (Verbose) - warnx("%d package deletion(s) failed", error); + pwarnx("%d package deletion(s) failed", error); return error; } else diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c index 9320b6af4db..f356d1f0fab 100644 --- a/usr.sbin/pkg_install/delete/perform.c +++ b/usr.sbin/pkg_install/delete/perform.c @@ -1,7 +1,7 @@ -/* $OpenBSD: perform.c,v 1.8 2000/04/28 21:08:16 espie Exp $ */ +/* $OpenBSD: perform.c,v 1.9 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: perform.c,v 1.8 2000/04/28 21:08:16 espie Exp $"; +static const char *rcsid = "$OpenBSD: perform.c,v 1.9 2001/04/08 16:45:47 espie Exp $"; #endif /* @@ -120,6 +120,7 @@ pkg_do(char *pkg) plist_t *p; char *dbdir; + set_pkg(pkg); /* Reset some state */ if (Plist.head) free_plist(&Plist); @@ -133,7 +134,7 @@ try_again: if (trim_end(pkg)) goto try_again; else { - warnx("no such package '%s' installed", pkg); + pwarnx("no such package '%s' installed", pkg); return 1; } } @@ -142,12 +143,12 @@ try_again: errx(2, "unable to get current working directory!"); } if (chdir(LogDir) == FAIL) { - warnx("unable to change directory to %s! deinstall failed", LogDir); + pwarnx("unable to change directory to %s! deinstall failed", LogDir); return 1; } if (!isemptyfile(REQUIRED_BY_FNAME)) { char buf[512]; - warnx("package `%s' is required by these other packages\n" + pwarnx("package `%s' is required by these other packages\n" "and may not be deinstalled%s:", pkg, Force ? " (but I'll delete it anyway)" : "" ); cfile = fopen(REQUIRED_BY_FNAME, "r"); @@ -156,14 +157,14 @@ try_again: fprintf(stderr, "%s", buf); fclose(cfile); } else - warnx("cannot open requirements file `%s'", REQUIRED_BY_FNAME); + pwarnx("cannot open requirements file `%s'", REQUIRED_BY_FNAME); if (!Force) return 1; } sanity_check(LogDir); cfile = fopen(CONTENTS_FNAME, "r"); if (!cfile) { - warnx("unable to open '%s' file", CONTENTS_FNAME); + pwarnx("unable to open '%s' file", CONTENTS_FNAME); return 1; } /* If we have a prefix, add it now */ @@ -173,18 +174,18 @@ try_again: fclose(cfile); p = find_plist(&Plist, PLIST_CWD); if (!p) { - warnx("package '%s' doesn't have a prefix", pkg); + pwarnx("package '%s' doesn't have a prefix", pkg); return 1; } { struct statfs buffer; if (statfs(p->name, &buffer) == -1) { - warnx("package '%s' prefix (%s) does not exist", pkg, p->name); + pwarnx("package '%s' prefix (%s) does not exist", pkg, p->name); return 1; } if (buffer.f_flags & MNT_RDONLY) { - warnx("package'%s' mount point %s is read-only", pkg, + pwarnx("package'%s' mount point %s is read-only", pkg, buffer.f_mntonname); return 1; } @@ -196,7 +197,7 @@ try_again: printf("Executing 'require' script.\n"); vsystem("chmod +x %s", REQUIRE_FNAME); /* be sure */ if (vsystem("./%s %s DEINSTALL", REQUIRE_FNAME, pkg)) { - warnx("package %s fails requirements %s", pkg, + pwarnx("package %s fails requirements %s", pkg, Force ? "" : "- not deleted"); if (!Force) return 1; @@ -208,7 +209,7 @@ try_again: else { vsystem("chmod +x %s", DEINSTALL_FNAME); /* make sure */ if (vsystem("./%s %s DEINSTALL", DEINSTALL_FNAME, pkg)) { - warnx("deinstall script returned error status"); + pwarnx("deinstall script returned error status"); if (!Force) return 1; } @@ -221,11 +222,11 @@ try_again: 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) - warnx( + pwarnx( "couldn't entirely delete package (perhaps the packing list is\n" "incorrectly specified?)"); if (vsystem("%s -r %s", REMOVE_CMD, LogDir)) { - warnx("couldn't remove log entry in %s, deinstall failed", LogDir); + pwarnx("couldn't remove log entry in %s, deinstall failed", LogDir); if (!Force) return 1; } @@ -277,21 +278,21 @@ undepend(const char *deppkgname, char *pkg2delname) deppkgname, REQUIRED_BY_FNAME); fp = fopen(fname, "r"); if (fp == NULL) { - warnx("couldn't open dependency file `%s'", fname); + pwarnx("couldn't open dependency file `%s'", fname); return 0; } (void) snprintf(ftmp, sizeof(ftmp), "%s.XXXXXX", fname); s = mkstemp(ftmp); if (s == -1) { fclose(fp); - warnx("couldn't open temp file `%s'", ftmp); + pwarnx("couldn't open temp file `%s'", ftmp); return 0; } fpwr = fdopen(s, "w"); if (fpwr == NULL) { close(s); fclose(fp); - warnx("couldn't fdopen temp file `%s'", ftmp); + pwarnx("couldn't fdopen temp file `%s'", ftmp); remove(ftmp); return 0; } @@ -303,18 +304,18 @@ undepend(const char *deppkgname, char *pkg2delname) } (void) fclose(fp); if (fchmod(s, 0644) == FAIL) { - warnx("error changing permission of temp file `%s'", ftmp); + pwarnx("error changing permission of temp file `%s'", ftmp); fclose(fpwr); remove(ftmp); return 0; } if (fclose(fpwr) == EOF) { - warnx("error closing temp file `%s'", ftmp); + pwarnx("error closing temp file `%s'", ftmp); remove(ftmp); return 0; } if (rename(ftmp, fname) == -1) - warnx("error renaming `%s' to `%s'", ftmp, fname); + pwarnx("error renaming `%s' to `%s'", ftmp, fname); remove(ftmp); /* just in case */ return 0; diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c index 55411bc39c9..ff89924ed21 100644 --- a/usr.sbin/pkg_install/info/main.c +++ b/usr.sbin/pkg_install/info/main.c @@ -1,7 +1,7 @@ -/* $OpenBSD: main.c,v 1.12 1999/02/28 18:55:25 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.13 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static char *rcsid = "$OpenBSD: main.c,v 1.12 1999/02/28 18:55:25 deraadt Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.13 2001/04/08 16:45:47 espie Exp $"; #endif /* @@ -148,7 +148,7 @@ main(int argc, char **argv) /* If no packages, yelp */ if (pkgs == start && !AllInstalled && !CheckPkg) - warnx("missing package name(s)"), usage(); + pwarnx("missing package name(s)"), usage(); *pkgs = NULL; return pkg_perform(start); } diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index f8c84efeb88..f9fe41d7e73 100644 --- a/usr.sbin/pkg_install/info/perform.c +++ b/usr.sbin/pkg_install/info/perform.c @@ -1,7 +1,7 @@ -/* $OpenBSD: perform.c,v 1.8 2000/04/10 18:44:31 espie Exp $ */ +/* $OpenBSD: perform.c,v 1.9 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: perform.c,v 1.8 2000/04/10 18:44:31 espie Exp $"; +static const char *rcsid = "$OpenBSD: perform.c,v 1.9 2001/04/08 16:45:47 espie Exp $"; #endif /* This is OpenBSD pkg_install, based on: @@ -79,6 +79,8 @@ pkg_do(char *pkg) int code = 0; char *pkg2 = 0; /* hold full name of package, storage to free */ + set_pkg(pkg); + if (isURL(pkg)) { if ((cp = fileGetURL(NULL, pkg)) != NULL) { strcpy(fname, cp); @@ -113,13 +115,13 @@ pkg_do(char *pkg) * be very optimistic. */ if (stat(fname, &sb) == FAIL) { - warnx("can't stat package file '%s'", fname); + pwarnx("can't stat package file '%s'", fname); code = 1; goto bail; } Home = make_playpen(PlayPen, PlayPenSize, sb.st_size / 2); if (unpack(fname, "+*")) { - warnx("error during unpacking, no info for '%s' available", pkg); + pwarnx("error during unpacking, no info for '%s' available", pkg); code = 1; goto bail; } @@ -139,13 +141,13 @@ pkg_do(char *pkg) pkg); if (!fexists(log_dir) && ! (pkg2 = find_prefix(log_dir, sizeof(log_dir), tmp, pkg))) { - warnx("can't find package `%s' installed or in a file!", pkg); + pwarnx("can't find package `%s' installed or in a file!", pkg); return 1; } if (pkg2) pkg = pkg2; if (chdir(log_dir) == FAIL) { - warnx("can't change directory to '%s'!", log_dir); + pwarnx("can't change directory to '%s'!", log_dir); free(pkg2); return 1; } @@ -163,7 +165,7 @@ pkg_do(char *pkg) plist.head = plist.tail = NULL; fp = fopen(CONTENTS_FNAME, "r"); if (!fp) { - warnx("unable to open %s file", CONTENTS_FNAME); + pwarnx("unable to open %s file", CONTENTS_FNAME); code = 1; goto bail; } diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index b172f16c38a..7c988cd419b 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -1,7 +1,7 @@ -/* $OpenBSD: show.c,v 1.8 2000/04/10 18:44:31 espie Exp $ */ +/* $OpenBSD: show.c,v 1.9 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: show.c,v 1.8 2000/04/10 18:44:31 espie Exp $"; +static const char *rcsid = "$OpenBSD: show.c,v 1.9 2001/04/08 16:45:47 espie Exp $"; #endif /* @@ -93,7 +93,7 @@ show_index(char *title, char *fname) printf("%s%-18s ", InfoPrefix, title); } if ((fp = fopen(fname, "r")) == (FILE *) NULL) { - warnx("show_file (%s): can't open '%s' for reading", title, fname); + pwarnx("show_file (%s): can't open '%s' for reading", title, fname); } else { if (fgets(line, MAXINDEXSIZE+1, fp)) { @@ -159,7 +159,7 @@ show_plist(char *title, package_t *plist, pl_ent_t type) printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose, p->name); break; default: - warnx("unknown command type %d (%s)", p->type, p->name); + pwarnx("unknown command type %d (%s)", p->type, p->name); } (void) fputc('\n', stdout); } diff --git a/usr.sbin/pkg_install/lib/Makefile b/usr.sbin/pkg_install/lib/Makefile index 632aba902a6..e1f0b4efbfa 100644 --- a/usr.sbin/pkg_install/lib/Makefile +++ b/usr.sbin/pkg_install/lib/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.4 1999/10/05 22:34:45 espie Exp $ +# $OpenBSD: Makefile,v 1.5 2001/04/08 16:45:47 espie Exp $ LIB= install -SRCS= file.c plist.c str.c exec.c global.c pen.c +SRCS= file.c plist.c str.c exec.c global.c pen.c pwarnx.c CFLAGS+= ${DEBUG} NOPROFILE= yes NOPIC= yes diff --git a/usr.sbin/pkg_install/lib/exec.c b/usr.sbin/pkg_install/lib/exec.c index aa0a68c9602..25fa5caf7c4 100644 --- a/usr.sbin/pkg_install/lib/exec.c +++ b/usr.sbin/pkg_install/lib/exec.c @@ -1,7 +1,7 @@ -/* $OpenBSD: exec.c,v 1.5 1998/10/13 23:09:52 marc Exp $ */ +/* $OpenBSD: exec.c,v 1.6 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: exec.c,v 1.5 1998/10/13 23:09:52 marc Exp $"; +static const char *rcsid = "$OpenBSD: exec.c,v 1.6 2001/04/08 16:45:47 espie Exp $"; #endif /* @@ -43,13 +43,13 @@ vsystem(const char *fmt, ...) maxargs = (size_t) sysconf(_SC_ARG_MAX); maxargs -= 32; /* some slop for the sh -c */ if ((cmd = (char *) malloc(maxargs)) == (char *) NULL) { - warnx("vsystem can't alloc arg space"); + pwarnx("vsystem can't alloc arg space"); return 1; } va_start(args, fmt); if (vsnprintf(cmd, maxargs, fmt, args) > maxargs) { - warnx("vsystem args are too long"); + pwarnx("vsystem args are too long"); return 1; } #ifdef DEBUG diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index fc22e9dbbf6..cf4f754236a 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -1,7 +1,7 @@ -/* $OpenBSD: file.c,v 1.13 2001/03/11 13:22:31 wilfried Exp $ */ +/* $OpenBSD: file.c,v 1.14 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: file.c,v 1.13 2001/03/11 13:22:31 wilfried Exp $"; +static const char *rcsid = "$OpenBSD: file.c,v 1.14 2001/04/08 16:45:47 espie Exp $"; #endif /* @@ -320,13 +320,13 @@ fileGetURL(char *base, char *spec) strlcpy(fname, spec, sizeof fname); cp = fileURLHost(fname, host, MAXHOSTNAMELEN); if (!*cp) { - warnx("URL `%s' has bad host part!", fname); + pwarnx("URL `%s' has bad host part!", fname); return NULL; } cp = fileURLFilename(fname, file, FILENAME_MAX); if (!*cp) { - warnx("URL `%s' has bad filename part!", fname); + pwarnx("URL `%s' has bad filename part!", fname); return NULL; } @@ -610,7 +610,7 @@ unpack(char *pkg, char *flist) strcpy(args, "z"); strcat(args, "xpf"); if (vsystem("tar %s %s %s", args, pkg, flist ? flist : "")) { - warnx("tar extract of %s failed!", pkg); + pwarnx("tar extract of %s failed!", pkg); return 1; } return 0; diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 7a349d18b69..1b66ad12da4 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.h,v 1.7 2001/04/02 10:13:40 espie Exp $ */ +/* $OpenBSD: lib.h,v 1.8 2001/04/08 16:45:47 espie Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -205,6 +205,10 @@ int delete_package(Boolean, Boolean, package_t *); /* For all */ int pkg_perform(char **); + +void set_pkg(const char *); +void pwarnx(const char *, ...); + /* Externs */ extern Boolean Verbose; extern Boolean Fake; diff --git a/usr.sbin/pkg_install/lib/pen.c b/usr.sbin/pkg_install/lib/pen.c index 7f1f2e8d38f..55160413ddb 100644 --- a/usr.sbin/pkg_install/lib/pen.c +++ b/usr.sbin/pkg_install/lib/pen.c @@ -1,7 +1,7 @@ -/* $OpenBSD: pen.c,v 1.8 1998/10/13 23:09:54 marc Exp $ */ +/* $OpenBSD: pen.c,v 1.9 2001/04/08 16:45:48 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: pen.c,v 1.8 1998/10/13 23:09:54 marc Exp $"; +static const char *rcsid = "$OpenBSD: pen.c,v 1.9 2001/04/08 16:45:48 espie Exp $"; #endif /* @@ -152,7 +152,7 @@ leave_playpen(char *save) abort(); } if (vsystem("rm -rf %s", Current)) - warnx("couldn't remove temporary dir '%s'", Current); + pwarnx("couldn't remove temporary dir '%s'", Current); strcpy(Current, Previous); } if (save) diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index 99b382b5fd1..9277fe55897 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -1,6 +1,6 @@ -/* $OpenBSD: plist.c,v 1.10 2001/04/02 10:13:40 espie Exp $ */ +/* $OpenBSD: plist.c,v 1.11 2001/04/08 16:45:48 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: plist.c,v 1.10 2001/04/02 10:13:40 espie Exp $"; +static const char *rcsid = "$OpenBSD: plist.c,v 1.11 2001/04/08 16:45:48 espie Exp $"; #endif /* @@ -245,7 +245,7 @@ read_plist(package_t *pkg, FILE *fp) if (pline[0] == CMD_CHAR) { cmd = plist_cmd(pline + 1, &cp); if (cmd == FAIL) { - warnx("Unrecognised PLIST command `%s'", pline); + pwarnx("Unrecognised PLIST command `%s'", pline); continue; } if (*cp == '\0') @@ -273,7 +273,7 @@ write_plist(package_t *pkg, FILE *fp) for (cmdp = cmdv ; cmdp->c_type != FAIL && cmdp->c_type != p->type ; cmdp++) { } if (cmdp->c_type == FAIL) { - warnx("Unknown PLIST command type %d (%s)", p->type, p->name); + pwarnx("Unknown PLIST command type %d (%s)", p->type, p->name); } else if (cmdp->c_argc == 0) { (void) fprintf(fp, "%c%s\n", CMD_CHAR, cmdp->c_s); } else { @@ -315,13 +315,13 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg) case PLIST_UNEXEC: if (!format_cmd(tmp, sizeof(tmp), p->name, Where, last_file)) { - warnx("unexec command `%s' could not expand", p->name); + pwarnx("unexec command `%s' could not expand", p->name); fail = FAIL; } else { if (Verbose) printf("Execute `%s'\n", tmp); if (!Fake && system(tmp)) { - warnx("unexec command for `%s' failed", tmp); + pwarnx("unexec command for `%s' failed", tmp); fail = FAIL; } } @@ -331,7 +331,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg) last_file = p->name; (void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name); if (isdir(tmp)) { - warnx("attempting to delete directory `%s' as a file\n" + pwarnx("attempting to delete directory `%s' as a file\n" "this packing list is incorrect - ignoring delete request", tmp); } else { @@ -363,10 +363,10 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg) (void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name); if (!isdir(tmp)) { if (fexists(tmp)) { - warnx("attempting to delete file `%s' as a directory\n" + pwarnx("attempting to delete file `%s' as a directory\n" "this packing list is incorrect - ignoring delete request", tmp); } else { - warnx("attempting to delete non-existent directory `%s'\n" + pwarnx("attempting to delete non-existent directory `%s'\n" "this packing list is incorrect - ignoring delete request", tmp); } } @@ -374,7 +374,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg) if (Verbose) printf("Delete directory %s\n", tmp); if (!Fake && delete_hierarchy(tmp, ign_err, FALSE)) { - warnx("unable to completely remove directory '%s'", tmp); + pwarnx("unable to completely remove directory '%s'", tmp); fail = FAIL; } } @@ -404,7 +404,7 @@ delete_hierarchy(char *dir, Boolean ign_err, Boolean nukedirs) cp1 = cp2 = dir; if (!fexists(dir)) { if (!ign_err) - warnx("%s `%s' doesn't really exist", + pwarnx("%s `%s' doesn't really exist", isdir(dir) ? "directory" : "file", dir); return !ign_err; } @@ -430,7 +430,7 @@ delete_hierarchy(char *dir, Boolean ign_err, Boolean nukedirs) return 0; if (RMDIR(dir) && !ign_err) { if (!fexists(dir)) - warnx("directory `%s' doesn't really exist", dir); + pwarnx("directory `%s' doesn't really exist", dir); else return 1; } diff --git a/usr.sbin/pkg_install/lib/pwarnx.c b/usr.sbin/pkg_install/lib/pwarnx.c new file mode 100644 index 00000000000..982cf27aa4f --- /dev/null +++ b/usr.sbin/pkg_install/lib/pwarnx.c @@ -0,0 +1,79 @@ +/* $OpenBSD: pwarnx.c,v 1.1 2001/04/08 16:45:48 espie Exp $ */ + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <stdarg.h> +#include <stdio.h> +#include <string.h> +#include "lib.h" + +static char pkgname[60]; + +void +set_pkg(name) + const char *name; +{ + + char *name2; + + if (name != NULL) { + name2 = strrchr(name, '/'); + if (name2 != NULL) + name = name2+1; + strlcpy(pkgname, name, sizeof pkgname); + name2 = strstr(pkgname, ".tgz"); + if (name2 != NULL && name2[4] == '\0') + *name2 = '\0'; + } else + pkgname[0] = '\0'; +} + + +extern char *__progname; + +void +pwarnx(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + + if (pkgname[0] == '\0') + (void)fprintf(stderr, "%s: ", __progname); + else + (void)fprintf(stderr, "%s(%s): ", __progname, pkgname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); + va_end(ap); +} diff --git a/usr.sbin/pkg_install/lib/str.c b/usr.sbin/pkg_install/lib/str.c index 572add98089..ef12746d43a 100644 --- a/usr.sbin/pkg_install/lib/str.c +++ b/usr.sbin/pkg_install/lib/str.c @@ -1,7 +1,7 @@ -/* $OpenBSD: str.c,v 1.4 1998/10/13 23:09:54 marc Exp $ */ +/* $OpenBSD: str.c,v 1.5 2001/04/08 16:45:48 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: str.c,v 1.4 1998/10/13 23:09:54 marc Exp $"; +static const char *rcsid = "$OpenBSD: str.c,v 1.5 2001/04/08 16:45:48 espie Exp $"; #endif /* @@ -204,7 +204,7 @@ alternate_match(const char *pattern, const char *pkg) } } if (cnt != 0) { - warnx("Malformed alternate `%s'", pattern); + pwarnx("Malformed alternate `%s'", pattern); return 1; } for (found = 0, cp = sep + 1; *sep != '}'; cp = sep + 1) { @@ -308,7 +308,7 @@ findmatchingname(const char *dir, const char *pattern, matchfn f, char *data) found = 0; if ((dirp = opendir(dir)) == NULL) { - /* warnx("can't opendir dir '%s'", dir); */ + /* pwarnx("can't opendir dir '%s'", dir); */ return -1; } while ((dp = readdir(dirp)) != NULL) { diff --git a/usr.sbin/pkg_install/sign/pgp_check.c b/usr.sbin/pkg_install/sign/pgp_check.c index 0e1a4a03879..391de043b45 100644 --- a/usr.sbin/pkg_install/sign/pgp_check.c +++ b/usr.sbin/pkg_install/sign/pgp_check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgp_check.c,v 1.2 1999/10/07 16:30:32 espie Exp $ */ +/* $OpenBSD: pgp_check.c,v 1.3 2001/04/08 16:45:48 espie Exp $ */ /*- * Copyright (c) 1999 Marc Espie. * @@ -105,12 +105,12 @@ new_pgp_checker(h, sign, userid, envp, filename) struct stat sbuf; if (stat(PGP, &sbuf) == -1) { - warnx("%s does not exist", PGP); + pwarnx("%s does not exist", PGP); return NULL; } } if (n == NULL) { - warnx("Can't allocate pgp_checker"); + pwarnx("Can't allocate pgp_checker"); return NULL; } @@ -144,7 +144,7 @@ new_pgp_checker(h, sign, userid, envp, filename) pgp_add(n, sign->data, sign->length); if (gzip_copy_header(h, sign->next, pgp_add, n) == 0) { - warnx("Unexpected header in %s", filename); + pwarnx("Unexpected header in %s", filename); n->status = PKG_SIGERROR; } return n; diff --git a/usr.sbin/pkg_install/sign/pgp_sign.c b/usr.sbin/pkg_install/sign/pgp_sign.c index 8997769450a..f2b3eda99d6 100644 --- a/usr.sbin/pkg_install/sign/pgp_sign.c +++ b/usr.sbin/pkg_install/sign/pgp_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgp_sign.c,v 1.1 1999/10/04 21:46:29 espie Exp $ */ +/* $OpenBSD: pgp_sign.c,v 1.2 2001/04/08 16:45:48 espie Exp $ */ /*- * Copyright (c) 1999 Marc Espie. * @@ -108,7 +108,7 @@ retrieve_pgp_signature(filename, sign, userid, envp) if (orig == NULL) return 0; if (gzip_read_header(orig, &h, &old) == GZIP_NOT_GZIP) { - warnx("File %s is not a gzip file\n", filename); + pwarnx("File %s is not a gzip file\n", filename); fclose(orig); return 0; } diff --git a/usr.sbin/pkg_install/sign/sha1.c b/usr.sbin/pkg_install/sign/sha1.c index 796b8cce664..0381441f40d 100644 --- a/usr.sbin/pkg_install/sign/sha1.c +++ b/usr.sbin/pkg_install/sign/sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1.c,v 1.1 1999/10/04 21:46:29 espie Exp $ */ +/* $OpenBSD: sha1.c,v 1.2 2001/04/08 16:45:48 espie Exp $ */ /*- * Copyright (c) 1999 Marc Espie. * @@ -84,13 +84,13 @@ new_sha1_checker(h, sign, userid, envp, filename) assert(sign->type == TAG_SHA1); /* make sure data conforms to what we can handle */ if (sign->length > MAXID || sign->data[sign->length-1] != '\0') { - warnx("Corrupted SHA1 header in %s", filename); + pwarnx("Corrupted SHA1 header in %s", filename); return 0; } n = malloc(sizeof *n); if (n == NULL) { - warnx("Can't allocate sha1_checker"); + pwarnx("Can't allocate sha1_checker"); return NULL; } SHA1Init(&n->context); @@ -99,7 +99,7 @@ new_sha1_checker(h, sign, userid, envp, filename) /* copy header, as this is a checksum, we don't strip our own marker */ if (gzip_copy_header(h, sign, sha1_add, n) == 0) { - warnx("Unexpected header in %s", filename); + pwarnx("Unexpected header in %s", filename); free(n); return 0; } @@ -145,10 +145,10 @@ sha1_sign_ok(arg) } if (tag_found) { - warnx("Checksum incorrect for %s (%s)", n->filename, n->id); + pwarnx("Checksum incorrect for %s (%s)", n->filename, n->id); return PKG_BADSIG; } else { - warnx("No checksum found for %s (%s)", n->filename, n->id); + pwarnx("No checksum found for %s (%s)", n->filename, n->id); return PKG_SIGUNKNOWN; } } @@ -187,7 +187,7 @@ retrieve_sha1_marker(filename, sign, userid) return 0; } if (gzip_read_header(f, &h, sign) == GZIP_NOT_GZIP) { - warnx("File %s is not a gzip file\n", filename); + pwarnx("File %s is not a gzip file\n", filename); fclose(f); free(n); return 0; |