Commit: 1bc05b605aed538351e2967e44d824d35b91ea13
Parent: 6c3c84844a8a8e886b96049f6effe20ced17a023
Author: deraadt
Date: Tue, 22 Mar 2022 20:36:49 +0000
minor KNF cleanups during a re-read
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/doas.c b/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.93 2021/11/30 20:08:15 tobias Exp $ */
+/* $OpenBSD: doas.c,v 1.97 2022/03/22 20:36:49 deraadt Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -231,6 +231,7 @@ authuser_checkpass(char *myname)
if (!challenge) {
char host[HOST_NAME_MAX + 1];
+
if (gethostname(host, sizeof(host)))
snprintf(host, sizeof(host), "?");
snprintf(cbuf, sizeof(cbuf),
diff --git a/parse.y b/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.29 2021/01/27 17:02:50 millert Exp $ */
+/* $OpenBSD: parse.y,v 1.31 2022/03/22 20:36:49 deraadt Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -85,6 +85,7 @@ grammar: /* empty */
rule: action ident target cmd {
struct rule *r;
+
r = calloc(1, sizeof(*r));
if (!r)
errx(1, "can't allocate rule");
@@ -157,6 +158,7 @@ strlist: /* empty */ {
errx(1, "can't allocate strlist");
} | strlist TSTRING {
int nstr = arraylen($1.strlist);
+
if (!($$.strlist = reallocarray($1.strlist, nstr + 2,
sizeof(char *))))
errx(1, "can't allocate strlist");