use fatal/fatalx instead of err/errx in daemon code

This commit is contained in:
Omar Polo 2023-06-09 17:27:41 +00:00
parent 68368f4c29
commit 792f302ace
3 changed files with 8 additions and 8 deletions

4
gmid.c
View File

@ -126,7 +126,7 @@ log_request(struct client *c, char *meta, size_t l)
ec = asprintf(&fmted, "%s:%s GET %s %.*s", hbuf, sbuf, b,
(int)(t-meta), meta);
if (ec == -1)
err(1, "asprintf");
fatal("asprintf");
proc_compose(conf->ps, PROC_LOGGER, IMSG_LOG_REQUEST,
fmted, ec + 1);
@ -231,7 +231,7 @@ main(int argc, char **argv)
conf = config_new();
if (parse_conf(conf, config_path) == -1)
errx(1, "failed to load configuration file");
fatalx("failed to load configuration file");
if (*conf->chroot != '\0' && *conf->user == '\0')
fatalx("can't chroot without a user to switch to after.");

View File

@ -442,7 +442,7 @@ fastcgi : string {
| TCP string PORT NUM {
char *c;
if (asprintf(&c, "%d", $4) == -1)
err(1, "asprintf");
fatal("asprintf");
loc->fcgi = fastcgi_conf($2, c);
free($2);
}
@ -476,7 +476,7 @@ medianames_l : medianames_l medianamesl
medianamesl : numberstring {
if (add_mime(&conf->mime, current_media, $1) == -1)
err(1, "add_mime");
fatal("add_mime");
free($1);
}
;

View File

@ -77,13 +77,13 @@ absolutify_path(const char *path)
if (*path == '/') {
if ((r = strdup(path)) == NULL)
err(1, "strdup");
fatal("strdup");
return r;
}
wd = getcwd(NULL, 0);
if (asprintf(&r, "%s/%s", wd, path) == -1)
err(1, "asprintf");
fatal("asprintf");
free(wd);
return r;
}
@ -94,7 +94,7 @@ xstrdup(const char *s)
char *d;
if ((d = strdup(s)) == NULL)
err(1, "strdup");
fatal("strdup");
return d;
}
@ -104,7 +104,7 @@ xcalloc(size_t nmemb, size_t size)
void *d;
if ((d = calloc(nmemb, size)) == NULL)
err(1, "calloc");
fatal("calloc");
return d;
}