From: krw Date: Wed, 11 Jul 2018 07:39:22 +0000 (+0000) Subject: Do for most running out of memory err() what was done for most running X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a062aa9d6a1c6c36ba1886ff476a56da7d9bd5de;p=openbsd Do for most running out of memory err() what was done for most running out of memory log_warn(). i.e. ("%s", __func__) instead of manual function names and redundant verbiage about which wrapper detected the out of memory condition. ok henning@ --- diff --git a/bin/chio/parse.y b/bin/chio/parse.y index b714bea27bf..cd3ce1330d1 100644 --- a/bin/chio/parse.y +++ b/bin/chio/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.20 2014/11/20 05:51:20 jsg Exp $ */ +/* $OpenBSD: parse.y,v 1.21 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2006 Bob Beck @@ -319,7 +319,7 @@ yylex(void) } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -377,7 +377,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/sbin/iked/parse.y b/sbin/iked/parse.y index 85f88dfa977..112049cdc6a 100644 --- a/sbin/iked/parse.y +++ b/sbin/iked/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.74 2018/07/09 12:05:10 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.75 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -1407,7 +1407,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -1465,7 +1465,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { @@ -1666,7 +1666,7 @@ cmdline_symset(char *s) len = strlen(s) - strlen(val) + 1; if ((sym = malloc(len)) == NULL) - err(1, "cmdline_symset: malloc"); + err(1, "%s", __func__); strlcpy(sym, s, len); @@ -1959,11 +1959,11 @@ host(const char *s) if (errno == ERANGE || !q || *q || mask > 128 || q == (p + 1)) errx(1, "host: invalid netmask '%s'", p); if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) - err(1, "host: calloc"); + err(1, "%s", __func__); strlcpy(ps, s, strlen(s) - strlen(p) + 1); } else { if ((ps = strdup(s)) == NULL) - err(1, "host: strdup"); + err(1, "%s", __func__); mask = -1; } @@ -2009,7 +2009,7 @@ host_v6(const char *s, int prefixlen) ipa = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa == NULL) - err(1, "host_v6: calloc"); + err(1, "%s", __func__); ipa->af = res->ai_family; memcpy(&ipa->address, res->ai_addr, sizeof(struct sockaddr_in6)); if (prefixlen > 128) @@ -2026,10 +2026,10 @@ host_v6(const char *s, int prefixlen) if (prefixlen != 128) { ipa->netaddress = 1; if (asprintf(&ipa->name, "%s/%d", hbuf, prefixlen) == -1) - err(1, "host_v6: asprintf"); + err(1, "%s", __func__); } else { if ((ipa->name = strdup(hbuf)) == NULL) - err(1, "host_v6: strdup"); + err(1, "%s", __func__); } freeaddrinfo(res); @@ -2056,7 +2056,7 @@ host_v4(const char *s, int mask) ipa = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa == NULL) - err(1, "host_v4: calloc"); + err(1, "%s", __func__); ina.sin_family = AF_INET; ina.sin_len = sizeof(ina); @@ -2064,7 +2064,7 @@ host_v4(const char *s, int mask) ipa->name = strdup(s); if (ipa->name == NULL) - err(1, "host_v4: strdup"); + err(1, "%s", __func__); ipa->af = AF_INET; ipa->next = NULL; ipa->tail = ipa; @@ -2098,7 +2098,7 @@ host_dns(const char *s, int mask) ipa = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa == NULL) - err(1, "host_dns: calloc"); + err(1, "%s", __func__); switch (res->ai_family) { case AF_INET: memcpy(&ipa->address, res->ai_addr, @@ -2115,7 +2115,7 @@ host_dns(const char *s, int mask) err(1, "host_dns: getnameinfo"); ipa->name = strdup(hbuf); if (ipa->name == NULL) - err(1, "host_dns: strdup"); + err(1, "%s", __func__); ipa->af = res->ai_family; ipa->next = NULL; ipa->tail = ipa; @@ -2162,7 +2162,7 @@ host_any(void) ipa = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa == NULL) - err(1, "host_any: calloc"); + err(1, "%s", __func__); ipa->af = AF_UNSPEC; ipa->netaddress = 1; ipa->tail = ipa; @@ -2191,10 +2191,10 @@ ifa_load(void) continue; n = calloc(1, sizeof(struct ipsec_addr_wrap)); if (n == NULL) - err(1, "ifa_load: calloc"); + err(1, "%s", __func__); n->af = ifa->ifa_addr->sa_family; if ((n->name = strdup(ifa->ifa_name)) == NULL) - err(1, "ifa_load: strdup"); + err(1, "%s", __func__); if (n->af == AF_INET) { sa_in = (struct sockaddr_in *)ifa->ifa_addr; memcpy(&n->address, sa_in, sizeof(*sa_in)); @@ -2270,7 +2270,7 @@ ifa_grouplookup(const char *ifa_name) len = ifgr.ifgr_len; if ((ifgr.ifgr_groups = calloc(1, len)) == NULL) - err(1, "calloc"); + err(1, "%s", __func__); if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) == -1) err(1, "ioctl"); @@ -2314,10 +2314,10 @@ ifa_lookup(const char *ifa_name) continue; n = calloc(1, sizeof(struct ipsec_addr_wrap)); if (n == NULL) - err(1, "ifa_lookup: calloc"); + err(1, "%s", __func__); memcpy(n, p, sizeof(struct ipsec_addr_wrap)); if ((n->name = strdup(p->name)) == NULL) - err(1, "ifa_lookup: strdup"); + err(1, "%s", __func__); switch (n->af) { case AF_INET: set_ipmask(n, 32); @@ -2634,7 +2634,7 @@ copy_transforms(unsigned int type, *dst = recallocarray(*dst, *ndst, *ndst + 1, sizeof(struct iked_transform)); if (*dst == NULL) - err(1, "copy_transforms: recallocarray"); + err(1, "%s", __func__); b = *dst + (*ndst)++; b->xform_type = type; @@ -2652,7 +2652,7 @@ copy_transforms(unsigned int type, *dst = recallocarray(*dst, *ndst, *ndst + 1, sizeof(struct iked_transform)); if (*dst == NULL) - err(1, "copy_transforms: recallocarray"); + err(1, "%s", __func__); b = *dst + (*ndst)++; memcpy(b, a, sizeof(*b)); } @@ -2804,7 +2804,7 @@ create_ike(char *name, int af, uint8_t ipproto, struct ipsec_hosts *hosts, if (ike_sa == NULL || ike_sa->nxfs == 0) { if ((p = calloc(1, sizeof(*p))) == NULL) - err(1, "create_ike: calloc"); + err(1, "%s", __func__); p->prop_id = ikepropid++; p->prop_protoid = IKEV2_SAPROTO_IKE; p->prop_nxforms = ikev2_default_nike_transforms; @@ -2814,7 +2814,7 @@ create_ike(char *name, int af, uint8_t ipproto, struct ipsec_hosts *hosts, } else { for (i = 0; i < ike_sa->nxfs; i++) { if ((p = calloc(1, sizeof(*p))) == NULL) - err(1, "create_ike: calloc"); + err(1, "%s", __func__); xf = NULL; xfi = 0; @@ -2850,7 +2850,7 @@ create_ike(char *name, int af, uint8_t ipproto, struct ipsec_hosts *hosts, if (ipsec_sa == NULL || ipsec_sa->nxfs == 0) { if ((p = calloc(1, sizeof(*p))) == NULL) - err(1, "create_ike: calloc"); + err(1, "%s", __func__); p->prop_id = ipsecpropid++; p->prop_protoid = saproto; p->prop_nxforms = ikev2_default_nesp_transforms; @@ -2876,7 +2876,7 @@ create_ike(char *name, int af, uint8_t ipproto, struct ipsec_hosts *hosts, } if ((p = calloc(1, sizeof(*p))) == NULL) - err(1, "create_ike: calloc"); + err(1, "%s", __func__); xf = NULL; xfi = 0; diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y index 5c71732dd4a..4b8f84704cc 100644 --- a/sbin/ipsecctl/parse.y +++ b/sbin/ipsecctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.172 2018/07/09 12:05:10 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.173 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -1204,7 +1204,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -1262,7 +1262,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { @@ -1432,7 +1432,7 @@ cmdline_symset(char *s) len = strlen(s) - strlen(val) + 1; if ((sym = malloc(len)) == NULL) - err(1, "cmdline_symset: malloc"); + err(1, "%s", __func__); strlcpy(sym, s, len); @@ -1515,12 +1515,12 @@ parsekey(unsigned char *hexkey, size_t len) key = calloc(1, sizeof(struct ipsec_key)); if (key == NULL) - err(1, "parsekey: calloc"); + err(1, "%s", __func__); key->len = len / 2; key->data = calloc(key->len, sizeof(u_int8_t)); if (key->data == NULL) - err(1, "parsekey: calloc"); + err(1, "%s", __func__); for (i = 0; i < (int)key->len; i++) key->data[i] = x2i(hexkey + 2 * i); @@ -1543,7 +1543,7 @@ parsekeyfile(char *filename) errx(1, "%s: key too %s", filename, sb.st_size ? "large" : "small"); if ((hex = calloc(sb.st_size, sizeof(unsigned char))) == NULL) - err(1, "parsekeyfile: calloc"); + err(1, "%s", __func__); if (read(fd, hex, sb.st_size) < sb.st_size) err(1, "parsekeyfile: read"); close(fd); @@ -1581,11 +1581,11 @@ host(const char *s) if (errno == ERANGE || !q || *q || mask > 128 || q == (p + 1)) errx(1, "host: invalid netmask '%s'", p); if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) - err(1, "host: calloc"); + err(1, "%s", __func__); strlcpy(ps, s, strlen(s) - strlen(p) + 1); } else { if ((ps = strdup(s)) == NULL) - err(1, "host: strdup"); + err(1, "%s", __func__); mask = -1; } @@ -1631,7 +1631,7 @@ host_v6(const char *s, int prefixlen) ipa = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa == NULL) - err(1, "host_v6: calloc"); + err(1, "%s", __func__); ipa->af = res->ai_family; memcpy(&ipa->address.v6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, @@ -1650,10 +1650,10 @@ host_v6(const char *s, int prefixlen) if (prefixlen != 128) { ipa->netaddress = 1; if (asprintf(&ipa->name, "%s/%d", hbuf, prefixlen) == -1) - err(1, "host_v6: asprintf"); + err(1, "%s", __func__); } else { if ((ipa->name = strdup(hbuf)) == NULL) - err(1, "host_v6: strdup"); + err(1, "%s", __func__); } freeaddrinfo(res); @@ -1679,12 +1679,12 @@ host_v4(const char *s, int mask) ipa = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa == NULL) - err(1, "host_v4: calloc"); + err(1, "%s", __func__); ipa->address.v4 = ina; ipa->name = strdup(s); if (ipa->name == NULL) - err(1, "host_v4: strdup"); + err(1, "%s", __func__); ipa->af = AF_INET; ipa->next = NULL; ipa->tail = ipa; @@ -1717,7 +1717,7 @@ host_dns(const char *s, int mask) ipa = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa == NULL) - err(1, "host_dns: calloc"); + err(1, "%s", __func__); switch (res->ai_family) { case AF_INET: memcpy(&ipa->address.v4, @@ -1741,7 +1741,7 @@ host_dns(const char *s, int mask) err(1, "host_dns: getnameinfo"); ipa->name = strdup(hbuf); if (ipa->name == NULL) - err(1, "host_dns: strdup"); + err(1, "%s", __func__); ipa->af = res->ai_family; ipa->next = NULL; ipa->tail = ipa; @@ -1788,7 +1788,7 @@ host_any(void) ipa = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa == NULL) - err(1, "host_any: calloc"); + err(1, "%s", __func__); ipa->af = AF_UNSPEC; ipa->netaddress = 1; ipa->tail = ipa; @@ -1815,10 +1815,10 @@ ifa_load(void) continue; n = calloc(1, sizeof(struct ipsec_addr_wrap)); if (n == NULL) - err(1, "ifa_load: calloc"); + err(1, "%s", __func__); n->af = ifa->ifa_addr->sa_family; if ((n->name = strdup(ifa->ifa_name)) == NULL) - err(1, "ifa_load: strdup"); + err(1, "%s", __func__); if (n->af == AF_INET) { n->af = AF_INET; memcpy(&n->address.v4, &((struct sockaddr_in *) @@ -1900,7 +1900,7 @@ ifa_grouplookup(const char *ifa_name) len = ifgr.ifgr_len; if ((ifgr.ifgr_groups = calloc(1, len)) == NULL) - err(1, "calloc"); + err(1, "%s", __func__); if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) == -1) err(1, "ioctl"); @@ -1942,10 +1942,10 @@ ifa_lookup(const char *ifa_name) continue; n = calloc(1, sizeof(struct ipsec_addr_wrap)); if (n == NULL) - err(1, "ifa_lookup: calloc"); + err(1, "%s", __func__); memcpy(n, p, sizeof(struct ipsec_addr_wrap)); if ((n->name = strdup(p->name)) == NULL) - err(1, "ifa_lookup: strdup"); + err(1, "%s", __func__); switch (n->af) { case AF_INET: set_ipmask(n, 32); @@ -2042,7 +2042,7 @@ parse_life(const char *value) life = calloc(1, sizeof(struct ipsec_lifetime)); if (life == NULL) - err(1, "calloc"); + err(1, "%s", __func__); life->lt_seconds = seconds; life->lt_bytes = -1; @@ -2060,7 +2060,7 @@ copytransforms(const struct ipsec_transforms *xfs) newxfs = calloc(1, sizeof(struct ipsec_transforms)); if (newxfs == NULL) - err(1, "copytransforms: calloc"); + err(1, "%s", __func__); memcpy(newxfs, xfs, sizeof(struct ipsec_transforms)); return (newxfs); @@ -2076,7 +2076,7 @@ copylife(const struct ipsec_lifetime *life) newlife = calloc(1, sizeof(struct ipsec_lifetime)); if (newlife == NULL) - err(1, "copylife: calloc"); + err(1, "%s", __func__); memcpy(newlife, life, sizeof(struct ipsec_lifetime)); return (newlife); @@ -2091,13 +2091,13 @@ copyipsecauth(const struct ipsec_auth *auth) return (NULL); if ((newauth = calloc(1, sizeof(struct ipsec_auth))) == NULL) - err(1, "calloc"); + err(1, "%s", __func__); if (auth->srcid && asprintf(&newauth->srcid, "%s", auth->srcid) == -1) - err(1, "asprintf"); + err(1, "%s", __func__); if (auth->dstid && asprintf(&newauth->dstid, "%s", auth->dstid) == -1) - err(1, "asprintf"); + err(1, "%s", __func__); newauth->srcid_type = auth->srcid_type; newauth->dstid_type = auth->dstid_type; @@ -2115,10 +2115,10 @@ copyikeauth(const struct ike_auth *auth) return (NULL); if ((newauth = calloc(1, sizeof(struct ike_auth))) == NULL) - err(1, "calloc"); + err(1, "%s", __func__); if (auth->string && asprintf(&newauth->string, "%s", auth->string) == -1) - err(1, "asprintf"); + err(1, "%s", __func__); newauth->type = auth->type; @@ -2134,9 +2134,9 @@ copykey(struct ipsec_key *key) return (NULL); if ((newkey = calloc(1, sizeof(struct ipsec_key))) == NULL) - err(1, "calloc"); + err(1, "%s", __func__); if ((newkey->data = calloc(key->len, sizeof(u_int8_t))) == NULL) - err(1, "calloc"); + err(1, "%s", __func__); memcpy(newkey->data, key->data, key->len); newkey->len = key->len; @@ -2153,12 +2153,12 @@ copyhost(const struct ipsec_addr_wrap *src) dst = calloc(1, sizeof(struct ipsec_addr_wrap)); if (dst == NULL) - err(1, "copyhost: calloc"); + err(1, "%s", __func__); memcpy(dst, src, sizeof(struct ipsec_addr_wrap)); if (src->name != NULL && (dst->name = strdup(src->name)) == NULL) - err(1, "copyhost: strdup"); + err(1, "%s", __func__); return dst; } @@ -2171,7 +2171,7 @@ copytag(const char *src) if (src == NULL) return (NULL); if ((tag = strdup(src)) == NULL) - err(1, "copytag: strdup"); + err(1, "%s", __func__); return (tag); } @@ -2182,7 +2182,7 @@ copyrule(struct ipsec_rule *rule) struct ipsec_rule *r; if ((r = calloc(1, sizeof(struct ipsec_rule))) == NULL) - err(1, "calloc"); + err(1, "%s", __func__); r->src = copyhost(rule->src); r->dst = copyhost(rule->dst); @@ -2410,7 +2410,7 @@ create_sa(u_int8_t satype, u_int8_t tmode, struct ipsec_hosts *hosts, r = calloc(1, sizeof(struct ipsec_rule)); if (r == NULL) - err(1, "create_sa: calloc"); + err(1, "%s", __func__); r->type |= RULE_SA; r->satype = satype; @@ -2437,7 +2437,7 @@ reverse_sa(struct ipsec_rule *rule, u_int32_t spi, struct ipsec_key *authkey, reverse = calloc(1, sizeof(struct ipsec_rule)); if (reverse == NULL) - err(1, "reverse_sa: calloc"); + err(1, "%s", __func__); reverse->type |= RULE_SA; reverse->satype = rule->satype; @@ -2460,7 +2460,7 @@ create_sabundle(struct ipsec_addr_wrap *dst, u_int8_t proto, u_int32_t spi, r = calloc(1, sizeof(struct ipsec_rule)); if (r == NULL) - err(1, "create_sabundle: calloc"); + err(1, "%s", __func__); r->type |= RULE_BUNDLE; @@ -2483,7 +2483,7 @@ create_flow(u_int8_t dir, u_int8_t proto, struct ipsec_hosts *hosts, r = calloc(1, sizeof(struct ipsec_rule)); if (r == NULL) - err(1, "create_flow: calloc"); + err(1, "%s", __func__); r->type |= RULE_FLOW; @@ -2522,7 +2522,7 @@ create_flow(u_int8_t dir, u_int8_t proto, struct ipsec_hosts *hosts, r->auth = calloc(1, sizeof(struct ipsec_auth)); if (r->auth == NULL) - err(1, "create_flow: calloc"); + err(1, "%s", __func__); r->auth->srcid = srcid; r->auth->dstid = dstid; r->auth->srcid_type = get_id_type(srcid); @@ -2556,15 +2556,15 @@ expand_any(struct ipsec_addr_wrap *ipa_in) ipa->af = AF_INET; ipa->netaddress = 1; if ((ipa->name = strdup("0.0.0.0/0")) == NULL) - err(1, "expand_any: strdup"); + err(1, "%s", __func__); ipa->next = calloc(1, sizeof(struct ipsec_addr_wrap)); if (ipa->next == NULL) - err(1, "expand_any: calloc"); + err(1, "%s", __func__); ipa->next->af = AF_INET6; ipa->next->netaddress = 1; if ((ipa->next->name = strdup("::/0")) == NULL) - err(1, "expand_any: strdup"); + err(1, "%s", __func__); ipa->next->next = oldnext; } @@ -2732,7 +2732,7 @@ reverse_rule(struct ipsec_rule *rule) reverse = calloc(1, sizeof(struct ipsec_rule)); if (reverse == NULL) - err(1, "reverse_rule: calloc"); + err(1, "%s", __func__); reverse->type |= RULE_FLOW; @@ -2757,13 +2757,13 @@ reverse_rule(struct ipsec_rule *rule) if (rule->auth) { reverse->auth = calloc(1, sizeof(struct ipsec_auth)); if (reverse->auth == NULL) - err(1, "reverse_rule: calloc"); + err(1, "%s", __func__); if (rule->auth->dstid && (reverse->auth->dstid = strdup(rule->auth->dstid)) == NULL) - err(1, "reverse_rule: strdup"); + err(1, "%s", __func__); if (rule->auth->srcid && (reverse->auth->srcid = strdup(rule->auth->srcid)) == NULL) - err(1, "reverse_rule: strdup"); + err(1, "%s", __func__); reverse->auth->srcid_type = rule->auth->srcid_type; reverse->auth->dstid_type = rule->auth->dstid_type; reverse->auth->type = rule->auth->type; @@ -2782,7 +2782,7 @@ create_ike(u_int8_t proto, struct ipsec_hosts *hosts, r = calloc(1, sizeof(struct ipsec_rule)); if (r == NULL) - err(1, "create_ike: calloc"); + err(1, "%s", __func__); r->type = RULE_IKE; @@ -2824,14 +2824,14 @@ create_ike(u_int8_t proto, struct ipsec_hosts *hosts, r->auth = calloc(1, sizeof(struct ipsec_auth)); if (r->auth == NULL) - err(1, "create_ike: calloc"); + err(1, "%s", __func__); r->auth->srcid = srcid; r->auth->dstid = dstid; r->auth->srcid_type = get_id_type(srcid); r->auth->dstid_type = get_id_type(dstid); r->ikeauth = calloc(1, sizeof(struct ike_auth)); if (r->ikeauth == NULL) - err(1, "create_ike: calloc"); + err(1, "%s", __func__); r->ikeauth->type = authtype->type; r->ikeauth->string = authtype->string; r->tag = tag; diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 707389f8099..0dfe9c67c86 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.678 2018/07/10 09:30:49 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.679 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -4139,7 +4139,7 @@ expand_label_str(char *label, size_t len, const char *srch, const char *repl) char *p, *q; if ((tmp = calloc(1, len)) == NULL) - err(1, "expand_label_str: calloc"); + err(1, "%s", __func__); p = q = label; while ((q = strstr(p, srch)) != NULL) { *q = '\0'; @@ -4729,12 +4729,12 @@ expand_rule(struct pf_rule *r, int keeprule, struct node_if *interfaces, if (src_host->addr.type == PF_ADDR_DYNIFTL) { osrch = src_host; if ((src_host = gen_dynnode(src_host, r->af)) == NULL) - err(1, "expand_rule: calloc"); + err(1, "%s", __func__); } if (dst_host->addr.type == PF_ADDR_DYNIFTL) { odsth = dst_host; if ((dst_host = gen_dynnode(dst_host, r->af)) == NULL) - err(1, "expand_rule: calloc"); + err(1, "%s", __func__); } error += check_netmask(src_host, r->af); @@ -4858,14 +4858,14 @@ expand_rule(struct pf_rule *r, int keeprule, struct node_if *interfaces, rb.direction = PF_IN; if ((srch = calloc(1, sizeof(*srch))) == NULL) - err(1, "expand_rule: calloc"); + err(1, "%s", __func__); bcopy(src_host, srch, sizeof(*srch)); srch->ifname = NULL; srch->next = NULL; srch->tail = NULL; if ((dsth = calloc(1, sizeof(*dsth))) == NULL) - err(1, "expand_rule: calloc"); + err(1, "%s", __func__); bcopy(&rb.nat.addr, &dsth->addr, sizeof(dsth->addr)); dsth->ifname = NULL; dsth->next = NULL; @@ -4874,7 +4874,7 @@ expand_rule(struct pf_rule *r, int keeprule, struct node_if *interfaces, bzero(&binat, sizeof(binat)); if ((binat.rdr = calloc(1, sizeof(*binat.rdr))) == NULL) - err(1, "expand_rule: calloc"); + err(1, "%s", __func__); bcopy(nat->rdr, binat.rdr, sizeof(*binat.rdr)); bcopy(&nat->pool_opts, &binat.pool_opts, sizeof(binat.pool_opts)); @@ -5198,7 +5198,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -5307,7 +5307,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); case '!': next = lgetc(0); @@ -5389,7 +5389,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { @@ -5570,7 +5570,7 @@ pfctl_cmdline_symset(char *s) return (-1); if ((sym = malloc(strlen(s) - strlen(val) + 1)) == NULL) - err(1, "pfctl_cmdline_symset: malloc"); + err(1, "%s", __func__); strlcpy(sym, s, strlen(s) - strlen(val) + 1); @@ -5857,7 +5857,7 @@ rdomain_exists(u_int rdomain) /* table nonexistent */ return 0; } - err(1, "sysctl"); + err(1, "%s", __func__); } if (info.rti_domainid == rdomain) { found[rdomain] = 1; diff --git a/usr.bin/doas/parse.y b/usr.bin/doas/parse.y index fde406bcf5a..dd9466e5f13 100644 --- a/usr.bin/doas/parse.y +++ b/usr.bin/doas/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.26 2017/01/02 01:40:20 tedu Exp $ */ +/* $OpenBSD: parse.y,v 1.27 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2015 Ted Unangst * @@ -331,7 +331,7 @@ eow: } } if ((str = strdup(buf)) == NULL) - err(1, "strdup"); + err(1, "%s", __func__); yylval.str = str; return TSTRING; diff --git a/usr.sbin/acme-client/parse.y b/usr.sbin/acme-client/parse.y index 207d3938157..cff8a64cf5c 100644 --- a/usr.sbin/acme-client/parse.y +++ b/usr.sbin/acme-client/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.24 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.25 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons @@ -517,7 +517,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -626,7 +626,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(EXIT_FAILURE, "yylex: strdup"); + err(EXIT_FAILURE, "%s", __func__); return (STRING); } @@ -684,7 +684,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) { if ((yylval.v.string = strdup(buf)) == NULL) - err(EXIT_FAILURE, "yylex: strdup"); + err(EXIT_FAILURE, "%s", __func__); } return (token); } @@ -754,7 +754,7 @@ parse_config(const char *filename, int opts) struct sym *sym, *next; if ((conf = calloc(1, sizeof(struct acme_conf))) == NULL) - err(EXIT_FAILURE, "parse_config"); + err(EXIT_FAILURE, "%s", __func__); conf->opts = opts; if ((file = pushfile(filename)) == NULL) { @@ -879,7 +879,7 @@ conf_new_authority(struct acme_conf *c, char *s) if (a) return (NULL); if ((a = calloc(1, sizeof(struct authority_c))) == NULL) - err(EXIT_FAILURE, "calloc"); + err(EXIT_FAILURE, "%s", __func__); TAILQ_INSERT_TAIL(&c->authority_list, a, entry); a->name = s; @@ -914,7 +914,7 @@ conf_new_domain(struct acme_conf *c, char *s) if (d) return (NULL); if ((d = calloc(1, sizeof(struct domain_c))) == NULL) - err(EXIT_FAILURE, "calloc"); + err(EXIT_FAILURE, "%s", __func__); TAILQ_INSERT_TAIL(&c->domain_list, d, entry); d->domain = s; @@ -948,7 +948,7 @@ conf_new_keyfile(struct acme_conf *c, char *s) } if ((k = calloc(1, sizeof(struct keyfile))) == NULL) - err(EXIT_FAILURE, "calloc"); + err(EXIT_FAILURE, "%s", __func__); LIST_INSERT_HEAD(&c->used_key_list, k, entry); k->name = s; diff --git a/usr.sbin/dvmrpd/parse.y b/usr.sbin/dvmrpd/parse.y index 4ce5fc147d2..4cde820bf4b 100644 --- a/usr.sbin/dvmrpd/parse.y +++ b/usr.sbin/dvmrpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.35 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.36 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2004, 2005, 2006 Esben Norby @@ -592,7 +592,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -650,7 +650,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/eigrpd/parse.y b/usr.sbin/eigrpd/parse.y index 972a6b2542c..eedb3a7e162 100644 --- a/usr.sbin/eigrpd/parse.y +++ b/usr.sbin/eigrpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.26 2018/07/10 16:42:12 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.27 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2015 Renato Westphal @@ -732,7 +732,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -841,7 +841,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -899,7 +899,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/hostapd/parse.y b/usr.sbin/hostapd/parse.y index aef75684e39..b2736493ece 100644 --- a/usr.sbin/hostapd/parse.y +++ b/usr.sbin/hostapd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.57 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.58 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2004, 2005, 2006 Reyk Floeter @@ -1420,7 +1420,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } diff --git a/usr.sbin/httpd/parse.y b/usr.sbin/httpd/parse.y index 412b786c254..962af87ffc2 100644 --- a/usr.sbin/httpd/parse.y +++ b/usr.sbin/httpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.104 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.105 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2007 - 2015 Reyk Floeter @@ -1401,7 +1401,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -1510,7 +1510,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -1568,7 +1568,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/ifstated/parse.y b/usr.sbin/ifstated/parse.y index 0fad69016f3..93feda6fddb 100644 --- a/usr.sbin/ifstated/parse.y +++ b/usr.sbin/ifstated/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.51 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.52 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2004 Ryan McBride @@ -586,7 +586,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -644,7 +644,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { @@ -731,7 +731,7 @@ parse_config(char *filename, int opts) struct ifsd_state *state; if ((conf = calloc(1, sizeof(struct ifsd_config))) == NULL) { - err(1, NULL); + err(1, "%s", __func__); return (NULL); } @@ -878,7 +878,7 @@ cmdline_symset(char *s) len = strlen(s) - strlen(val) + 1; if ((sym = malloc(len)) == NULL) - err(1, NULL); + err(1, "%s", __func__); strlcpy(sym, s, len); @@ -921,12 +921,12 @@ init_state(struct ifsd_state *state) TAILQ_INIT(&state->external_tests); if ((state->init = calloc(1, sizeof(*state->init))) == NULL) - err(1, "init_state: calloc"); + err(1, "%s", __func__); state->init->type = IFSD_ACTION_CONDITION; TAILQ_INIT(&state->init->act.c.actions); if ((state->body = calloc(1, sizeof(*state->body))) == NULL) - err(1, "init_state: calloc"); + err(1, "%s", __func__); state->body->type = IFSD_ACTION_CONDITION; TAILQ_INIT(&state->body->act.c.actions); } @@ -948,7 +948,7 @@ new_ifstate(char *ifname, int s) break; if (ifstate == NULL) { if ((ifstate = calloc(1, sizeof(*ifstate))) == NULL) - err(1, NULL); + err(1, "%s", __func__); if (strlcpy(ifstate->ifname, ifname, sizeof(ifstate->ifname)) >= sizeof(ifstate->ifname)) errx(1, "ifname strlcpy truncation"); @@ -979,9 +979,9 @@ new_external(char *command, u_int32_t frequency) break; if (external == NULL) { if ((external = calloc(1, sizeof(*external))) == NULL) - err(1, NULL); + err(1, "%s", __func__); if ((external->command = strdup(command)) == NULL) - err(1, NULL); + err(1, "%s", __func__); external->frequency = frequency; TAILQ_INIT(&external->expressions); TAILQ_INSERT_TAIL(&state->external_tests, external, entries); diff --git a/usr.sbin/iscsictl/parse.y b/usr.sbin/iscsictl/parse.y index 7da81d57b4d..12262e8ee0e 100644 --- a/usr.sbin/iscsictl/parse.y +++ b/usr.sbin/iscsictl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.14 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.15 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2010 David Gwynne @@ -467,7 +467,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -576,7 +576,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -634,7 +634,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/ldapd/parse.y b/usr.sbin/ldapd/parse.y index 5df9ed35dee..c0082ce3ee9 100644 --- a/usr.sbin/ldapd/parse.y +++ b/usr.sbin/ldapd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.31 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.32 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -562,7 +562,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } diff --git a/usr.sbin/ldpd/parse.y b/usr.sbin/ldpd/parse.y index ff2aa801e6d..cc70041d4d9 100644 --- a/usr.sbin/ldpd/parse.y +++ b/usr.sbin/ldpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.64 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.65 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2013, 2015, 2016 Renato Westphal @@ -955,7 +955,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -1064,7 +1064,7 @@ yylex(void) } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -1122,7 +1122,7 @@ yylex(void) *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/lpd/parse.y b/usr.sbin/lpd/parse.y index 608818e772f..eae721cf2ab 100644 --- a/usr.sbin/lpd/parse.y +++ b/usr.sbin/lpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.2 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.3 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -446,7 +446,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -511,7 +511,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { @@ -689,7 +689,7 @@ cmdline_symset(char *s) len = strlen(s) - strlen(val) + 1; if ((sym = malloc(len)) == NULL) - errx(1, "cmdline_symset: malloc"); + errx(1, "%s", __func__); (void)strlcpy(sym, s, len); diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y index 833bb72cc0b..32b1492a63f 100644 --- a/usr.sbin/ospf6d/parse.y +++ b/usr.sbin/ospf6d/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.34 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.35 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby @@ -677,7 +677,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -786,7 +786,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -844,7 +844,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { @@ -1171,7 +1171,7 @@ prefix(const char *s, struct in6_addr *addr, u_int8_t *plen) errx(1, "invalid netmask: %s", errstr); if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) - err(1, "parse_prefix: malloc"); + err(1, "%s", __func__); strlcpy(ps, s, strlen(s) - strlen(p) + 1); if (host(ps, addr) == 0) { diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y index ef25c23f253..2333711c1e1 100644 --- a/usr.sbin/ospfd/parse.y +++ b/usr.sbin/ospfd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.90 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.91 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby @@ -922,7 +922,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -1031,7 +1031,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -1089,7 +1089,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index 414f2555af3..85b01d266b8 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.225 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.226 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter @@ -2412,7 +2412,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -2521,7 +2521,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -2579,7 +2579,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/ripd/parse.y b/usr.sbin/ripd/parse.y index 7d805b7d6cc..a67f9aa1cc0 100644 --- a/usr.sbin/ripd/parse.y +++ b/usr.sbin/ripd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.40 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.41 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2006 Michele Marchetto @@ -617,7 +617,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -675,7 +675,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index f8a2b77fdc6..4037d8ae659 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.215 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.216 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -1763,7 +1763,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -1872,7 +1872,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -1937,7 +1937,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/snmpd/parse.y b/usr.sbin/snmpd/parse.y index 12cbd60d6d7..f4ac69a1701 100644 --- a/usr.sbin/snmpd/parse.y +++ b/usr.sbin/snmpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.50 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.51 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -748,7 +748,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -857,7 +857,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -915,7 +915,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { diff --git a/usr.sbin/switchd/parse.y b/usr.sbin/switchd/parse.y index f10899c7d7f..81ab0dafd81 100644 --- a/usr.sbin/switchd/parse.y +++ b/usr.sbin/switchd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.9 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.10 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2007-2016 Reyk Floeter @@ -388,7 +388,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } diff --git a/usr.sbin/vmd/parse.y b/usr.sbin/vmd/parse.y index af0c949c5c1..d9db33eac98 100644 --- a/usr.sbin/vmd/parse.y +++ b/usr.sbin/vmd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.38 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.39 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2007-2016 Reyk Floeter @@ -787,7 +787,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } diff --git a/usr.sbin/ypldap/parse.y b/usr.sbin/ypldap/parse.y index c3e7c98c05f..c55e8ab876b 100644 --- a/usr.sbin/ypldap/parse.y +++ b/usr.sbin/ypldap/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.27 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.28 2018/07/11 07:39:22 krw Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -685,7 +685,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (STRING); } @@ -743,7 +743,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s", __func__); return (token); } if (c == '\n') { @@ -937,7 +937,7 @@ cmdline_symset(char *s) len = strlen(s) - strlen(val) + 1; if ((sym = malloc(len)) == NULL) - errx(1, "cmdline_symset: malloc"); + errx(1, "%s", __func__); (void)strlcpy(sym, s, len);