diff options
author | alfred <alfred@FreeBSD.org> | 2002-05-11 03:48:49 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-05-11 03:48:49 +0000 |
commit | 7be446ee1c9d1c224ed502e2943f86134e3e174f (patch) | |
tree | dfb1883ff0dc02633230f624e01908bce5789799 /usr.sbin/pkg_install/lib | |
parent | 02509bfc4bc35c1903d356df602509ca34028118 (diff) | |
download | FreeBSD-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/lib')
-rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 19 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/pen.c | 20 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/plist.c | 5 |
3 files changed, 23 insertions, 21 deletions
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; |