diff options
author | mmcc <mmcc@cvs.openbsd.org> | 2016-01-29 02:22:58 +0000 |
---|---|---|
committer | mmcc <mmcc@cvs.openbsd.org> | 2016-01-29 02:22:58 +0000 |
commit | 3d10fc4842b2de3d2e00c77af21e4f6e3c9dbe73 (patch) | |
tree | df265b58ecf59c8a1168341e00e20fbbec8c2ac8 /usr.sbin | |
parent | 1f62d9e75803cb001d5419814cb5b138d3a696a9 (diff) |
Fix err.h uses, reporting errno when available and simplifying error
messages.
Partially from Michael Reed.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ifstated/parse.y | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/ifstated/parse.y b/usr.sbin/ifstated/parse.y index 4794352c21a..5679164727f 100644 --- a/usr.sbin/ifstated/parse.y +++ b/usr.sbin/ifstated/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.36 2014/11/20 05:51:20 jsg Exp $ */ +/* $OpenBSD: parse.y,v 1.37 2016/01/29 02:22:57 mmcc Exp $ */ /* * Copyright (c) 2004 Ryan McBride <mcbride@openbsd.org> @@ -266,7 +266,7 @@ ext_test : STRING EVERY NUMBER { term : if_test { if (($$ = calloc(1, sizeof(*$$))) == NULL) - errx(1, "term: calloc"); + err(1, NULL); curaction->act.c.expression = $$; $$->type = IFSD_OPER_IFSTATE; $$->u.ifstate = $1; @@ -274,7 +274,7 @@ term : if_test { } | ext_test { if (($$ = calloc(1, sizeof(*$$))) == NULL) - errx(1, "term: calloc"); + err(1, NULL); curaction->act.c.expression = $$; $$->type = IFSD_OPER_EXTERNAL; $$->u.external = $1; @@ -287,7 +287,7 @@ term : if_test { expr : '!' expr %prec UNARY { if (($$ = calloc(1, sizeof(*$$))) == NULL) - errx(1, "expr: calloc"); + err(1, NULL); curaction->act.c.expression = $$; $$->type = IFSD_OPER_NOT; $2->parent = $$; @@ -295,7 +295,7 @@ expr : '!' expr %prec UNARY { } | expr AND expr { if (($$ = calloc(1, sizeof(*$$))) == NULL) - errx(1, "expr: calloc"); + err(1, NULL); curaction->act.c.expression = $$; $$->type = IFSD_OPER_AND; $1->parent = $$; @@ -305,7 +305,7 @@ expr : '!' expr %prec UNARY { } | expr OR expr { if (($$ = calloc(1, sizeof(*$$))) == NULL) - errx(1, "expr: calloc"); + err(1, NULL); curaction->act.c.expression = $$; $$->type = IFSD_OPER_OR; $1->parent = $$; @@ -326,7 +326,7 @@ state : STATE string { YYERROR; } if ((state = calloc(1, sizeof(*curstate))) == NULL) - errx(1, "state: calloc"); + err(1, NULL); init_state(state); state->name = $2; curstate = state; @@ -685,7 +685,7 @@ pushfile(const char *name, int secret) return (NULL); } if ((nfile->stream = fopen(nfile->name, "r")) == NULL) { - warnx("%s", nfile->name); + warn("%s", nfile->name); free(nfile->name); free(nfile); return (NULL); @@ -725,7 +725,7 @@ parse_config(char *filename, int opts) struct ifsd_state *state; if ((conf = calloc(1, sizeof(struct ifsd_config))) == NULL) { - errx(1, "parse_config calloc"); + err(1, NULL); return (NULL); } @@ -872,7 +872,7 @@ cmdline_symset(char *s) len = strlen(s) - strlen(val) + 1; if ((sym = malloc(len)) == NULL) - errx(1, "cmdline_symset: malloc"); + err(1, NULL); strlcpy(sym, s, len); @@ -940,7 +940,7 @@ new_ifstate(u_short ifindex, int s) break; if (ifstate == NULL) { if ((ifstate = calloc(1, sizeof(*ifstate))) == NULL) - errx(1, "new_ifstate: calloc"); + err(1, NULL); ifstate->ifindex = ifindex; ifstate->ifstate = s; TAILQ_INIT(&ifstate->expressions); @@ -968,9 +968,9 @@ new_external(char *command, u_int32_t frequency) break; if (external == NULL) { if ((external = calloc(1, sizeof(*external))) == NULL) - errx(1, "new_external: calloc"); + err(1, NULL); if ((external->command = strdup(command)) == NULL) - errx(1, "new_external: strdup"); + err(1, NULL); external->frequency = frequency; TAILQ_INIT(&external->expressions); TAILQ_INSERT_TAIL(&state->external_tests, external, entries); |