From b6a86f14c6598dcc721d84c18dbd2e97378970e7 Mon Sep 17 00:00:00 2001 From: anton Date: Mon, 10 Jul 2023 17:45:17 +0000 Subject: [PATCH] Improve err/warn messages: * The colon space separator is already appended by err/warn. * Favor err(1, NULL) for malloc errors. --- regress/sys/net/pf_trans/dev-limit.c | 4 ++-- regress/sys/net/pf_trans/iocmd-limit.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/regress/sys/net/pf_trans/dev-limit.c b/regress/sys/net/pf_trans/dev-limit.c index b766a1e5a13..b4e1f88ff59 100644 --- a/regress/sys/net/pf_trans/dev-limit.c +++ b/regress/sys/net/pf_trans/dev-limit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev-limit.c,v 1.1 2023/07/06 19:55:58 sashan Exp $ */ +/* $OpenBSD: dev-limit.c,v 1.2 2023/07/10 17:45:17 anton Exp $ */ /* * Copyright (c) 2023 Alexandr Nedvedicky @@ -114,7 +114,7 @@ main(int argc, char *const argv[]) signal(SIGCHLD, handle_sigchild); pids = (pid_t *)malloc(sizeof(pid_t) * chld_count); if (pids == 0) - err(1, "%s malloc: ", argv[0]); + err(1, NULL); i = 0; while ((sigchild == 0) && (i < chld_count)) { diff --git a/regress/sys/net/pf_trans/iocmd-limit.c b/regress/sys/net/pf_trans/iocmd-limit.c index 53d197a5454..f847abd2a87 100644 --- a/regress/sys/net/pf_trans/iocmd-limit.c +++ b/regress/sys/net/pf_trans/iocmd-limit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iocmd-limit.c,v 1.1 2023/07/06 19:55:58 sashan Exp $ */ +/* $OpenBSD: iocmd-limit.c,v 1.2 2023/07/10 17:45:17 anton Exp $ */ /* * Copyright (c) 2023 Alexandr Nedvedicky @@ -65,7 +65,7 @@ do_DIOCGETRULES_test(int dev) * exit right away. */ if (errno != EBUSY) - err(1, "%s DIOCGETRULES: ", __func__); + err(1, "%s DIOCGETRULES", __func__); } return (rv); @@ -100,9 +100,9 @@ do_DIOCXEND_test(int dev) pr.rule.action = PF_PASS; if ((rv = ioctl(dev, DIOCGETRULES, &pr)) == -1) - warn("%s DIOCGETRULES: ", __func__); + warn("%s DIOCGETRULES", __func__); else if ((rv = ioctl(dev, DIOCXEND, &pr.ticket)) == -1) - warn("%s DIOCXEND: ", __func__); + warn("%s DIOCXEND", __func__); return (rv); } @@ -190,7 +190,7 @@ main(int argc, char *const argv[]) dev = open("/dev/pf", O_RDONLY); if (dev < 0) - err(1, "open(\"dev/pf\"): "); + err(1, "open(\"dev/pf\")"); while (i < iterations) { if (test_iocmd->iocmd_test(dev) != 0) -- 2.20.1