diff options
Diffstat (limited to 'usr.sbin/pkg_install/create/perform.c')
-rw-r--r-- | usr.sbin/pkg_install/create/perform.c | 28 |
1 files changed, 17 insertions, 11 deletions
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__); } } |