summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-05-11 03:48:49 +0000
committeralfred <alfred@FreeBSD.org>2002-05-11 03:48:49 +0000
commit7be446ee1c9d1c224ed502e2943f86134e3e174f (patch)
treedfb1883ff0dc02633230f624e01908bce5789799 /usr.sbin/pkg_install
parent02509bfc4bc35c1903d356df602509ca34028118 (diff)
downloadFreeBSD-src-7be446ee1c9d1c224ed502e2943f86134e3e174f.zip
FreeBSD-src-7be446ee1c9d1c224ed502e2943f86134e3e174f.tar.gz
fix build:
you may not use string concatination with __FUNCTION__, replace all occurances of: __FUNCTION__ ": error string" with: "%s: error string"
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/add/extract.c24
-rw-r--r--usr.sbin/pkg_install/create/perform.c28
-rw-r--r--usr.sbin/pkg_install/create/pl.c8
-rw-r--r--usr.sbin/pkg_install/delete/perform.c11
-rw-r--r--usr.sbin/pkg_install/info/show.c3
-rw-r--r--usr.sbin/pkg_install/lib/file.c19
-rw-r--r--usr.sbin/pkg_install/lib/pen.c20
-rw-r--r--usr.sbin/pkg_install/lib/plist.c5
8 files changed, 67 insertions, 51 deletions
diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c
index 1574f0e..8771190 100644
--- a/usr.sbin/pkg_install/add/extract.c
+++ b/usr.sbin/pkg_install/add/extract.c
@@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$");
strcat(where_args, todir); \
if (system(where_args)) { \
cleanup(0); \
- errx(2, __FUNCTION__ ": can not invoke %ld byte tar pipeline: %s", \
+ errx(2, \
+ "%s: can not invoke %ld byte tar pipeline: %s", \
+ __FUNCTION__, \
(long)strlen(where_args), where_args); \
} \
strcpy(where_args, STARTSTRING); \
@@ -88,12 +90,12 @@ extract_plist(const char *home, Package *pkg)
where_args = alloca(maxargs);
if (!where_args) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't get argument list space");
+ errx(2, "%s: can't get argument list space", __FUNCTION__);
}
perm_args = alloca(maxargs);
if (!perm_args) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't get argument list space");
+ errx(2, "%s: can't get argument list space", __FUNCTION__);
}
strcpy(where_args, STARTSTRING);
@@ -130,7 +132,7 @@ extract_plist(const char *home, Package *pkg)
if (strrchr(p->name,'\'')) {
cleanup(0);
- errx(2, __FUNCTION__ ": Bogus filename \"%s\"", p->name);
+ errx(2, "%s: Bogus filename \"%s\"", __FUNCTION__, p->name);
}
/* first try to rename it into place */
@@ -159,7 +161,7 @@ extract_plist(const char *home, Package *pkg)
add_count = snprintf(&perm_args[perm_count], maxargs - perm_count, "'%s' ", p->name);
if (add_count < 0 || add_count > maxargs - perm_count) {
cleanup(0);
- errx(2, __FUNCTION__ ": oops, miscounted strings!");
+ errx(2, "%s: oops, miscounted strings!", __FUNCTION__);
}
perm_count += add_count;
}
@@ -179,7 +181,7 @@ extract_plist(const char *home, Package *pkg)
add_count = snprintf(&where_args[where_count], maxargs - where_count, " '%s'", p->name);
if (add_count < 0 || add_count > maxargs - where_count) {
cleanup(0);
- errx(2, __FUNCTION__ ": oops, miscounted strings!");
+ errx(2, "%s: oops, miscounted strings!", __FUNCTION__);
}
where_count += add_count;
add_count = snprintf(&perm_args[perm_count],
@@ -187,7 +189,7 @@ extract_plist(const char *home, Package *pkg)
"'%s' ", p->name);
if (add_count < 0 || add_count > maxargs - perm_count) {
cleanup(0);
- errx(2, __FUNCTION__ ": oops, miscounted strings!");
+ errx(2, "%s: oops, miscounted strings!", __FUNCTION__);
}
perm_count += add_count;
}
@@ -201,7 +203,7 @@ extract_plist(const char *home, Package *pkg)
if (strcmp(p->name, ".")) {
if (!Fake && make_hierarchy(p->name) == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": unable to cwd to '%s'", p->name);
+ errx(2, "%s: unable to cwd to '%s'", __FUNCTION__, p->name);
}
Directory = p->name;
}
@@ -213,11 +215,13 @@ extract_plist(const char *home, Package *pkg)
if ((strstr(p->name, "%B") || strstr(p->name, "%F") ||
strstr(p->name, "%f")) && last_file == NULL) {
cleanup(0);
- errx(2, __FUNCTION__ ": no last file specified for '%s' command", p->name);
+ errx(2, "%s: no last file specified for '%s' command",
+ __FUNCTION__, p->name);
}
if (strstr(p->name, "%D") && Directory == NULL) {
cleanup(0);
- errx(2, __FUNCTION__ ": no directory specified for '%s' command", p->name);
+ errx(2, "%s: no directory specified for '%s' command",
+ __FUNCTION__, p->name);
}
format_cmd(cmd, p->name, Directory, last_file);
PUSHOUT(Directory);
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index ca708ff..0c6ebdc 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -94,7 +94,8 @@ pkg_perform(char **pkgs)
pkg_in = fopen(Contents, "r");
if (!pkg_in) {
cleanup(0);
- errx(2, __FUNCTION__ ": unable to open contents file '%s' for input", Contents);
+ errx(2, "%s: unable to open contents file '%s' for input",
+ __FUNCTION__, Contents);
}
}
plist.head = plist.tail = NULL;
@@ -255,12 +256,14 @@ pkg_perform(char **pkgs)
fp = fopen(CONTENTS_FNAME, "w");
if (!fp) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't open file %s for writing", CONTENTS_FNAME);
+ errx(2, "%s: can't open file %s for writing",
+ __FUNCTION__, CONTENTS_FNAME);
}
write_plist(&plist, fp);
if (fclose(fp)) {
cleanup(0);
- errx(2, __FUNCTION__ ": error while closing %s", CONTENTS_FNAME);
+ errx(2, "%s: error while closing %s",
+ __FUNCTION__, CONTENTS_FNAME);
}
/* And stick it into a tar ball */
@@ -325,11 +328,11 @@ make_dist(const char *homedir, const char *pkg, const char *suff, Package *plist
/* Set up a pipe for passing the filenames, and fork off a tar process. */
if (pipe(pipefds) == -1) {
cleanup(0);
- errx(2, __FUNCTION__ ": cannot create pipe");
+ errx(2, "%s: cannot create pipe", __FUNCTION__);
}
if ((pid = fork()) == -1) {
cleanup(0);
- errx(2, __FUNCTION__ ": cannot fork process for tar");
+ errx(2, "%s: cannot fork process for tar", __FUNCTION__);
}
if (pid == 0) { /* The child */
dup2(pipefds[0], 0);
@@ -337,14 +340,14 @@ make_dist(const char *homedir, const char *pkg, const char *suff, Package *plist
close(pipefds[1]);
execv("/usr/bin/tar", (char * const *)(uintptr_t)args);
cleanup(0);
- errx(2, __FUNCTION__ ": failed to execute tar command");
+ errx(2, "%s: failed to execute tar command", __FUNCTION__);
}
/* Meanwhile, back in the parent process ... */
close(pipefds[0]);
if ((totar = fdopen(pipefds[1], "w")) == NULL) {
cleanup(0);
- errx(2, __FUNCTION__ ": fdopen failed");
+ errx(2, "%s: fdopen failed", __FUNCTION__);
}
fprintf(totar, "%s\n", CONTENTS_FNAME);
@@ -380,7 +383,7 @@ make_dist(const char *homedir, const char *pkg, const char *suff, Package *plist
/* assume either signal or bad exit is enough for us */
if (ret) {
cleanup(0);
- errx(2, __FUNCTION__ ": tar command failed with code %d", ret);
+ errx(2, "%s: tar command failed with code %d", __FUNCTION__, ret);
}
}
@@ -389,15 +392,18 @@ sanity_check()
{
if (!Comment) {
cleanup(0);
- errx(2, __FUNCTION__ ": required package comment string is missing (-c comment)");
+ errx(2, "%s: required package comment string is missing (-c comment)",
+ __FUNCTION__);
}
if (!Desc) {
cleanup(0);
- errx(2, __FUNCTION__ ": required package description string is missing (-d desc)");
+ errx(2, "%s: required package description string is missing (-d desc)",
+ __FUNCTION__);
}
if (!Contents) {
cleanup(0);
- errx(2, __FUNCTION__ ": required package contents list is missing (-f [-]file)");
+ errx(2, "%s: required package contents list is missing (-f [-]file)",
+ __FUNCTION__);
}
}
diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c
index eb4076b..0859e1f 100644
--- a/usr.sbin/pkg_install/create/pl.c
+++ b/usr.sbin/pkg_install/create/pl.c
@@ -102,7 +102,7 @@ trylink(const char *from, const char *to)
strcat(where_args, "|tar xpf -"); \
if (system(where_args)) { \
cleanup(0); \
- errx(2, __FUNCTION__ ": can't invoke tar pipeline"); \
+ errx(2, "%s: can't invoke tar pipeline", __FUNCTION__); \
} \
memset(where_args, 0, maxargs); \
last_chdir = NULL; \
@@ -134,7 +134,7 @@ copy_plist(const char *home, Package *plist)
where_args = malloc(maxargs);
if (!where_args) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't get argument list space");
+ errx(2, "%s: can't get argument list space", __FUNCTION__);
}
memset(where_args, 0, maxargs);
@@ -203,7 +203,7 @@ copy_plist(const char *home, Package *plist)
}
if (add_count < 0 || add_count > maxargs - where_count) {
cleanup(0);
- errx(2, __FUNCTION__ ": oops, miscounted strings!");
+ errx(2, "%s: oops, miscounted strings!", __FUNCTION__);
}
where_count += add_count;
}
@@ -241,7 +241,7 @@ copy_plist(const char *home, Package *plist)
p->name);
if (add_count < 0 || add_count > maxargs - where_count) {
cleanup(0);
- errx(2, __FUNCTION__ ": oops, miscounted strings!");
+ errx(2, "%s: oops, miscounted strings!", __FUNCTION__);
}
where_count += add_count;
last_chdir = (mythere ? mythere : where);
diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c
index 77635ef..ffbfbd9 100644
--- a/usr.sbin/pkg_install/delete/perform.c
+++ b/usr.sbin/pkg_install/delete/perform.c
@@ -140,7 +140,7 @@ pkg_do(char *pkg)
if (!getcwd(home, FILENAME_MAX)) {
cleanup(0);
- errx(2, __FUNCTION__ ": unable to get current working directory!");
+ errx(2, "%s: unable to get current working directory!", __FUNCTION__);
}
if (chdir(LogDir) == FAIL) {
@@ -240,7 +240,8 @@ pkg_do(char *pkg)
if (chdir(home) == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": unable to return to working directory %s!", home);
+ errx(2, "%s: unable to return to working directory %s!", __FUNCTION__,
+ home);
}
/*
@@ -272,7 +273,8 @@ pkg_do(char *pkg)
if (chdir(home) == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": unable to return to working directory %s!", home);
+ errx(2, "%s: unable to return to working directory %s!", __FUNCTION__,
+ home);
}
if (!Fake) {
@@ -299,7 +301,8 @@ sanity_check(char *pkg)
{
if (!fexists(CONTENTS_FNAME)) {
cleanup(0);
- errx(2, __FUNCTION__ ": installed package %s has no %s file!", pkg, CONTENTS_FNAME);
+ errx(2, "%s: installed package %s has no %s file!", __FUNCTION__,
+ pkg, CONTENTS_FNAME);
}
}
diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c
index 940e55a..efeb513 100644
--- a/usr.sbin/pkg_install/info/show.c
+++ b/usr.sbin/pkg_install/info/show.c
@@ -179,7 +179,8 @@ show_plist(const char *title, Package *plist, plist_t type, Boolean showall)
default:
cleanup(0);
- errx(2, __FUNCTION__ ": unknown command type %d (%s)", p->type, p->name);
+ errx(2, "%s: unknown command type %d (%s)",
+ __FUNCTION__, p->type, p->name);
break;
}
p = p->next;
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c
index fabbc15..df87201 100644
--- a/usr.sbin/pkg_install/lib/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -300,18 +300,18 @@ fileGetContents(const char *fname)
if (stat(fname, &sb) == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't stat '%s'", fname);
+ errx(2, "%s: can't stat '%s'", __FUNCTION__, fname);
}
contents = (char *)malloc(sb.st_size + 1);
fd = open(fname, O_RDONLY, 0);
if (fd == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": unable to open '%s' for reading", fname);
+ errx(2, "%s: unable to open '%s' for reading", __FUNCTION__, fname);
}
if (read(fd, contents, sb.st_size) != sb.st_size) {
cleanup(0);
- errx(2, __FUNCTION__ ": short read on '%s' - did not get %qd bytes",
+ errx(2, "%s: short read on '%s' - did not get %qd bytes", __FUNCTION__,
fname, (long long)sb.st_size);
}
close(fd);
@@ -364,16 +364,17 @@ write_file(const char *name, const char *str)
fp = fopen(name, "w");
if (!fp) {
cleanup(0);
- errx(2, __FUNCTION__ ": cannot fopen '%s' for writing", name);
+ errx(2, "%s: cannot fopen '%s' for writing", __FUNCTION__, name);
}
len = strlen(str);
if (fwrite(str, 1, len, fp) != len) {
cleanup(0);
- errx(2, __FUNCTION__ ": short fwrite on '%s', tried to write %ld bytes", name, (long)len);
+ errx(2, "%s: short fwrite on '%s', tried to write %ld bytes",
+ __FUNCTION__, name, (long)len);
}
if (fclose(fp)) {
cleanup(0);
- errx(2, __FUNCTION__ ": failure to fclose '%s'", name);
+ errx(2, "%s: failure to fclose '%s'", __FUNCTION__, name);
}
}
@@ -388,7 +389,7 @@ copy_file(const char *dir, const char *fname, const char *to)
snprintf(cmd, FILENAME_MAX, "cp -r %s/%s %s", dir, fname, to);
if (vsystem(cmd)) {
cleanup(0);
- errx(2, __FUNCTION__ ": could not perform '%s'", cmd);
+ errx(2, "%s: could not perform '%s'", __FUNCTION__, cmd);
}
}
@@ -403,7 +404,7 @@ move_file(const char *dir, const char *fname, const char *to)
snprintf(cmd, FILENAME_MAX, "mv %s/%s %s", dir, fname, to);
if (vsystem(cmd)) {
cleanup(0);
- errx(2, __FUNCTION__ ": could not perform '%s'", cmd);
+ errx(2, "%s: could not perform '%s'", __FUNCTION__, cmd);
}
}
@@ -435,7 +436,7 @@ copy_hierarchy(const char *dir, const char *fname, Boolean to)
#endif
if (system(cmd)) {
cleanup(0);
- errx(2, __FUNCTION__ ": could not perform '%s'", cmd);
+ errx(2, "%s: could not perform '%s'", __FUNCTION__, cmd);
}
}
diff --git a/usr.sbin/pkg_install/lib/pen.c b/usr.sbin/pkg_install/lib/pen.c
index b76b4a6..5879108 100644
--- a/usr.sbin/pkg_install/lib/pen.c
+++ b/usr.sbin/pkg_install/lib/pen.c
@@ -59,10 +59,10 @@ find_play_pen(char *pen, off_t sz)
strcpy(pen, "/usr/tmp/instmp.XXXXXX");
else {
cleanup(0);
- errx(2, __FUNCTION__
-": can't find enough temporary space to extract the files, please set your\n"
+ errx(2,
+"%s: can't find enough temporary space to extract the files, please set your\n"
"PKG_TMPDIR environment variable to a location with at least %ld bytes\n"
-"free", (long)sz);
+"free", __FUNCTION__, (long)sz);
return NULL;
}
return pen;
@@ -76,7 +76,7 @@ static void
pushPen(const char *pen)
{
if (++pdepth == MAX_STACK)
- errx(2, __FUNCTION__ ": stack overflow.\n");
+ errx(2, "%s: stack overflow.\n", __FUNCTION__);
pstack[pdepth] = strdup(pen);
}
@@ -103,11 +103,11 @@ make_playpen(char *pen, off_t sz)
if (!mkdtemp(pen)) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't mktemp '%s'", pen);
+ errx(2, "%s: can't mktemp '%s'", __FUNCTION__, pen);
}
if (chmod(pen, 0700) == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't mkdir '%s'", pen);
+ errx(2, "%s: can't mkdir '%s'", __FUNCTION__, pen);
}
if (Verbose) {
@@ -118,9 +118,9 @@ make_playpen(char *pen, off_t sz)
if (min_free(pen) < sz) {
rmdir(pen);
cleanup(0);
- errx(2, __FUNCTION__ ": not enough free space to create '%s'.\n"
+ errx(2, "%s: not enough free space to create '%s'.\n"
"Please set your PKG_TMPDIR environment variable to a location\n"
- "with more space and\ntry the command again", pen);
+ "with more space and\ntry the command again", __FUNCTION__, pen);
}
if (!getcwd(Previous, FILENAME_MAX)) {
@@ -130,7 +130,7 @@ make_playpen(char *pen, off_t sz)
if (chdir(pen) == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't chdir to '%s'", pen);
+ errx(2, "%s: can't chdir to '%s'", __FUNCTION__, pen);
}
if (PenLocation[0])
@@ -151,7 +151,7 @@ leave_playpen()
if (Previous[0]) {
if (chdir(Previous) == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": can't chdir back to '%s'", Previous);
+ errx(2, "%s: can't chdir back to '%s'", __FUNCTION__, Previous);
}
Previous[0] = '\0';
}
diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c
index 7c59929..0f7a010 100644
--- a/usr.sbin/pkg_install/lib/plist.c
+++ b/usr.sbin/pkg_install/lib/plist.c
@@ -275,7 +275,7 @@ read_plist(Package *pkg, FILE *fp)
cmd = plist_cmd(pline + 1, &cp);
if (cmd == FAIL) {
cleanup(0);
- errx(2, __FUNCTION__ ": bad command '%s'", pline);
+ errx(2, "%s: bad command '%s'", __FUNCTION__, pline);
}
if (*cp == '\0') {
cp = NULL;
@@ -384,7 +384,8 @@ write_plist(Package *pkg, FILE *fp)
default:
cleanup(0);
- errx(2, __FUNCTION__ ": unknown command type %d (%s)", plist->type, plist->name);
+ errx(2, "%s: unknown command type %d (%s)", __FUNCTION__,
+ plist->type, plist->name);
break;
}
plist = plist->next;
OpenPOWER on IntegriCloud