1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

Remove unwanted trailing newlines from err/warn format strings.

This commit is contained in:
anton 2024-08-23 12:56:26 +00:00
parent cd409aaefe
commit 6822f9c803
23 changed files with 69 additions and 68 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bn_mod_sqrt.c,v 1.10 2023/04/11 10:10:52 tb Exp $ */
/* $OpenBSD: bn_mod_sqrt.c,v 1.11 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2022,2023 Theo Buehler <tb@openbsd.org>
@ -2865,7 +2865,7 @@ mod_sqrt_test(struct mod_sqrt_test *test, BN_CTX *ctx)
if (!BN_hex2bn(&want, test->sqrt))
errx(1, "BN_hex2bn(%s)", test->sqrt);
if (!BN_mod_sub(diff, want, got, p, ctx))
errx(1, "BN_mod_sub() failed\n");
errx(1, "BN_mod_sub() failed");
if (!BN_is_zero(diff)) {
fprintf(stderr, "a: %s\n", test->a);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bn_word.c,v 1.1 2023/03/11 14:04:21 jsing Exp $ */
/* $OpenBSD: bn_word.c,v 1.2 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
*
@ -51,7 +51,7 @@ check_bn_word_test(const char *op_name, const BIGNUM *bn,
}
if ((out_hex = BN_bn2hex(bn)) == NULL)
errx(1, "BN_bn2hex() failed\n");
errx(1, "BN_bn2hex() failed");
if (strcmp(out_hex, bwt->out_hex) != 0) {
fprintf(stderr, "FAIL %s: Got hex %s, want %s\n",
@ -82,7 +82,7 @@ test_bn_word(int (*bn_word_op)(BIGNUM *, BN_ULONG), const char *op_name,
int failed = 0;
if ((bn = BN_new()) == NULL)
errx(1, "BN_new() failed\n");
errx(1, "BN_new() failed");
for (i = 0; i < num_tests; i++) {
bwt = &bwts[i];
@ -428,7 +428,7 @@ test_bn_div_word(void)
int failed = 0;
if ((bn = BN_new()) == NULL)
errx(1, "BN_new() failed\n");
errx(1, "BN_new() failed");
for (i = 0; i < N_BN_DIV_WORD_TESTS; i++) {
bwt = &bn_div_word_tests[i];
@ -574,7 +574,7 @@ test_bn_mod_word(void)
int failed = 0;
if ((bn = BN_new()) == NULL)
errx(1, "BN_new() failed\n");
errx(1, "BN_new() failed");
for (i = 0; i < N_BN_MOD_WORD_TESTS; i++) {
bwt = &bn_mod_word_tests[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: callback.c,v 1.4 2023/01/28 19:12:20 tb Exp $ */
/* $OpenBSD: callback.c,v 1.5 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@ -158,7 +158,7 @@ verify_cert(const char *roots_dir, const char *roots_file,
verify_err = X509_STORE_CTX_get_error(xsc);
if (verify_err == 0)
errx(1, "Error unset on failure!\n");
errx(1, "Error unset on failure!");
fprintf(stderr, "failed to verify at %d: %s\n",
X509_STORE_CTX_get_error_depth(xsc),

View File

@ -1,4 +1,4 @@
/* $OpenBSD: callbackfailures.c,v 1.2 2023/01/28 19:12:20 tb Exp $ */
/* $OpenBSD: callbackfailures.c,v 1.3 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@ -167,7 +167,7 @@ verify_cert(const char *roots_dir, const char *roots_file,
verify_err = X509_STORE_CTX_get_error(xsc);
if (verify_err == 0)
errx(1, "Error unset on failure!\n");
errx(1, "Error unset on failure!");
fprintf(stderr, "failed to verify at %d: %s\n",
X509_STORE_CTX_get_error_depth(xsc),

View File

@ -1,4 +1,4 @@
/* $OpenBSD: expirecallback.c,v 1.3 2023/01/28 19:12:20 tb Exp $ */
/* $OpenBSD: expirecallback.c,v 1.4 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@ -172,7 +172,7 @@ verify_cert(const char *roots_dir, const char *roots_file,
}
if (*error == 0)
errx(1, "Error unset on failure!\n");
errx(1, "Error unset on failure!");
fprintf(stderr, "failed to verify at %d: %s\n",
*error_depth, X509_verify_cert_error_string(*error));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: policy.c,v 1.12 2023/06/02 08:35:10 tb Exp $ */
/* $OpenBSD: policy.c,v 1.13 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2020-2023 Bob Beck <beck@openbsd.org>
@ -182,7 +182,7 @@ verify_cert(const char *roots_file, const char *intermediate_file,
}
if (*error == 0)
errx(1, "Error unset on failure!\n");
errx(1, "Error unset on failure!");
fprintf(stderr, "failed to verify at %d: %s\n",
*error_depth, X509_verify_cert_error_string(*error));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: verify.c,v 1.11 2023/01/28 19:12:20 tb Exp $ */
/* $OpenBSD: verify.c,v 1.12 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@ -162,7 +162,7 @@ verify_cert(const char *roots_dir, const char *roots_file,
}
if (*error == 0)
errx(1, "Error unset on failure!\n");
errx(1, "Error unset on failure!");
fprintf(stderr, "failed to verify at %d: %s\n",
*error_depth, X509_verify_cert_error_string(*error));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: key_schedule.c,v 1.10 2022/11/26 16:08:56 tb Exp $ */
/* $OpenBSD: key_schedule.c,v 1.11 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2018-2019 Bob Beck <beck@openbsd.org>
*
@ -188,7 +188,7 @@ main (int argc, char **argv)
struct tls13_secrets *secrets;
if ((secrets = tls13_secrets_create(EVP_sha256(), 0)) == NULL)
errx(1,"failed to create secrets\n");
errx(1, "failed to create secrets");
secrets->insecure = 1; /* don't explicit_bzero when done */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: aa.c,v 1.2 2007/08/01 12:53:28 kurt Exp $ */
/* $OpenBSD: aa.c,v 1.3 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2007 Kurt Miller <kurt@openbsd.org>
@ -27,5 +27,5 @@ void test_aa()
{
libaa_hidden_val = hidden_check;
if (hidden_check != &hidden_check)
errx(1, "libaa: hidden_check != &hidden_check\n");
errx(1, "libaa: hidden_check != &hidden_check");
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ab.c,v 1.2 2007/08/01 12:53:28 kurt Exp $ */
/* $OpenBSD: ab.c,v 1.3 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2007 Kurt Miller <kurt@openbsd.org>
@ -27,5 +27,5 @@ void test_ab()
{
libab_hidden_val = hidden_check;
if (hidden_check != &hidden_check)
errx(1, "libab: hidden_check != &hidden_check\n");
errx(1, "libab: hidden_check != &hidden_check");
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: test1.c,v 1.3 2017/08/07 16:33:52 bluhm Exp $ */
/* $OpenBSD: test1.c,v 1.4 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2007 Kurt Miller <kurt@openbsd.org>
@ -35,28 +35,28 @@ main()
libaa = dlopen(LIBAA, RTLD_LAZY);
libab = dlopen(LIBAB, RTLD_LAZY);
if (libaa == NULL)
errx(1, "dlopen(%s, RTLD_LAZY) FAILED\n", LIBAA);
errx(1, "dlopen(%s, RTLD_LAZY) FAILED", LIBAA);
if (libab == NULL)
errx(1, "dlopen(%s, RTLD_LAZY) FAILED\n", LIBAB);
errx(1, "dlopen(%s, RTLD_LAZY) FAILED", LIBAB);
hidden_test = (void (*)())dlsym(libaa, "test_aa");
if (hidden_test == NULL)
errx(1, "dlsym(libaa, \"test_aa\") FAILED\n");
errx(1, "dlsym(libaa, \"test_aa\") FAILED");
(*hidden_test)();
hidden_test = (void (*)())dlsym(libab, "test_ab");
if (hidden_test == NULL)
errx(1, "dlsym(libab, \"test_ab\") FAILED\n");
errx(1, "dlsym(libab, \"test_ab\") FAILED");
(*hidden_test)();
if (hidden_check != NULL)
errx(1, "hidden_check != NULL in main prog\n");
errx(1, "hidden_check != NULL in main prog");
if (libaa_hidden_val == NULL || libab_hidden_val == NULL ||
libaa_hidden_val == libab_hidden_val)
errx(1, "incorrect hidden_check detected in libs\n");
errx(1, "incorrect hidden_check detected in libs");
dlclose(libaa);
dlclose(libab);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: test2.c,v 1.3 2017/08/07 16:33:52 bluhm Exp $ */
/* $OpenBSD: test2.c,v 1.4 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2007 Kurt Miller <kurt@openbsd.org>
@ -36,11 +36,11 @@ main()
test_ab();
if (hidden_check != NULL)
errx(1, "hidden_check != NULL in main prog\n");
errx(1, "hidden_check != NULL in main prog");
if (libaa_hidden_val == NULL || libab_hidden_val == NULL ||
libaa_hidden_val == libab_hidden_val)
errx(1, "incorrect hidden_check detected in libs\n");
errx(1, "incorrect hidden_check detected in libs");
return (0);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: foo.c,v 1.3 2017/08/07 16:33:52 bluhm Exp $ */
/* $OpenBSD: foo.c,v 1.4 2024/08/23 12:56:26 anton Exp $ */
/* Public domain. 2008, Matthieu Herrb */
#include <dlfcn.h>
@ -15,7 +15,7 @@ foo_init(void)
printf("loading %s\n", BAR);
h = dlopen(BAR, RTLD_LAZY|RTLD_GLOBAL);
if (h == NULL)
errx(1, "dlopen %s: %s\n", BAR, dlerror());
errx(1, "dlopen %s: %s", BAR, dlerror());
printf("loaded: %s\n", BAR);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: prog.c,v 1.3 2017/02/25 07:28:32 jsg Exp $ */
/* $OpenBSD: prog.c,v 1.4 2024/08/23 12:56:26 anton Exp $ */
/* Public Domain, 2008, Matthieu Herrb */
#include <dlfcn.h>
@ -19,7 +19,7 @@ main(int argc, char *argv[])
printf("loading: %s\n", FOO);
handle = dlopen(FOO, RTLD_LAZY|RTLD_GLOBAL);
if (handle == NULL) {
errx(1, "dlopen: %s: %s\n", FOO, dlerror());
errx(1, "dlopen: %s: %s", FOO, dlerror());
}
printf("loaded: %s\n", FOO);
printf("looking up foo\n");

View File

@ -1,4 +1,4 @@
/* $OpenBSD: changerule.c,v 1.1 2021/11/11 12:49:53 sashan Exp $ */
/* $OpenBSD: changerule.c,v 1.2 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2021 Alexandr Nedvedicky <sashan@openbsd.org>
*
@ -96,7 +96,7 @@ do_chng_cmd(char *anchorname, int cmd, int rule_no)
if (strlcpy(pf.anchor->path, anchorname,
sizeof(pf.anchor->path)) >= sizeof (pf.anchor->path))
errx(1, "%s: strlcpy\n", __func__);
errx(1, "%s: strlcpy", __func__);
pf.astack[0] = pf.anchor;
pf.asd = 0;
@ -204,7 +204,7 @@ main(int argc, char *argv[])
int len = strlen(anchoropt);
if (anchoropt[len - 1] == '*') {
warnx("wildcard anchors not supported\n");
warnx("wildcard anchors not supported");
changerule_usage();
}
if (strlcpy(anchorname, anchoropt,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vcpu.c,v 1.7 2024/04/09 21:55:16 dv Exp $ */
/* $OpenBSD: vcpu.c,v 1.8 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2022 Dave Voutila <dv@openbsd.org>
@ -253,7 +253,7 @@ main(int argc, char **argv)
}
}
if (ours == NULL) {
warn("failed to find vm %uz\n", vcp.vcp_id);
warn("failed to find vm %uz", vcp.vcp_id);
goto out;
}
@ -306,7 +306,7 @@ main(int argc, char **argv)
}
if (vrunp.vrp_vm_id != vcp.vcp_id) {
warnx("expected vm id %uz, got %uz\n", vcp.vcp_id,
warnx("expected vm id %uz, got %uz", vcp.vcp_id,
vrunp.vrp_vm_id);
goto out;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kcov.c,v 1.17 2022/01/11 06:01:15 anton Exp $ */
/* $OpenBSD: kcov.c,v 1.18 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2018 Anton Lindqvist <anton@openbsd.org>
@ -197,20 +197,20 @@ check_coverage(const unsigned long *cover, int mode, unsigned long maxsize,
if (nonzero == -1) {
return 0;
} else if (nonzero && cover[0] == 0) {
warnx("coverage empty (count=0)\n");
warnx("coverage empty (count=0)");
return 1;
} else if (!nonzero && cover[0] != 0) {
warnx("coverage not empty (count=%lu)\n", *cover);
warnx("coverage not empty (count=%lu)", *cover);
return 1;
} else if (cover[0] >= maxsize) {
warnx("coverage overflow (count=%lu, max=%lu)\n",
warnx("coverage overflow (count=%lu, max=%lu)",
*cover, maxsize);
return 1;
}
if (mode == KCOV_MODE_TRACE_CMP) {
if (*cover * 4 >= maxsize) {
warnx("coverage cmp overflow (count=%lu, max=%lu)\n",
warnx("coverage cmp overflow (count=%lu, max=%lu)",
*cover * 4, maxsize);
return 1;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cmsgsize.c,v 1.3 2020/01/22 07:52:37 deraadt Exp $ */
/* $OpenBSD: cmsgsize.c,v 1.4 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2017 Alexander Markert <alexander.markert@siemens.com>
* Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org>
@ -58,7 +58,7 @@ main(int argc, char *argv[])
bytes = test_cmsgsize(so, &src, &dst, CFG_SO_MAX_SEND_BUFFER,
CFG_SO_MAX_SEND_BUFFER);
if (bytes >= 0)
errx(1, "1: %d bytes sent\n", bytes);
errx(1, "1: %d bytes sent", bytes);
if (errno != EMSGSIZE)
err(-1, "1: incorrect errno");
close(so);
@ -70,7 +70,7 @@ main(int argc, char *argv[])
bytes = test_cmsgsize(so, &src, &dst, CFG_SO_MAX_SEND_BUFFER,
CFG_SO_MAX_SEND_BUFFER);
if (bytes >= 0)
errx(1, "2: %d bytes sent\n", bytes);
errx(1, "2: %d bytes sent", bytes);
if (errno != EMSGSIZE)
err(-1, "2: incorrect errno");
close(so);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: getpeereid_test.c,v 1.4 2017/03/08 19:28:47 deraadt Exp $ */
/* $OpenBSD: getpeereid_test.c,v 1.5 2024/08/23 12:56:26 anton Exp $ */
/* Written by Marc Espie in 2006 */
/* Public domain */
#include <sys/types.h>
@ -142,7 +142,8 @@ main()
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
printf("getpeereid test okay\n");
exit(0);
} else
errx(1, "Problem with child\n");
} else {
errx(1, "Problem with child");
}
}
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sig-stop.c,v 1.1 2020/09/16 14:02:23 mpi Exp $ */
/* $OpenBSD: sig-stop.c,v 1.2 2024/08/23 12:56:26 anton Exp $ */
/*
* Written by Artur Grabowski <art@openbsd.org> 2007 Public Domain.
*/
@ -51,7 +51,7 @@ main(int argc, char **argv)
(toggle ? WIFSTOPPED(status) : WIFCONTINUED(status)));
if (!WIFEXITED(status))
err(1, "bad status: %d\n", status);
err(1, "bad status: %d", status);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: syscalls.c,v 1.35 2022/09/05 05:34:25 anton Exp $ */
/* $OpenBSD: syscalls.c,v 1.36 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2017-2019 Bob Beck <beck@openbsd.org>
@ -867,7 +867,7 @@ test_fork_locked(int do_uv)
status = 0;
waitpid(pid, &status, 0);
if (WIFSIGNALED(status))
errx(1, "child exited with signal %d\n", WTERMSIG(status));
errx(1, "child exited with signal %d", WTERMSIG(status));
if (WEXITSTATUS(status) == 0)
return 0;
else

View File

@ -1,4 +1,4 @@
/* $OpenBSD: util.c,v 1.14 2023/11/11 07:34:54 anton Exp $ */
/* $OpenBSD: util.c,v 1.15 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@ -130,12 +130,12 @@ route_insert(unsigned int rid, sa_family_t af, char *string)
if ((error = rtable_insert(rid, ndst, mask, NULL, 0, rt)) != 0) {
inet_net_satop(af, ndst, plen, ip, sizeof(ip));
errx(1, "can't add route: %s, %s\n", ip, strerror(error));
errx(1, "can't add route: %s, %s", ip, strerror(error));
}
nrt = rtable_lookup(rid, dst, mask, NULL, RTP_ANY);
if (nrt != rt) {
inet_net_satop(af, rt_key(rt), plen, ip, sizeof(ip));
errx(1, "added route not found: %s\n", ip);
errx(1, "added route not found: %s", ip);
}
rtfree(rt);
rtfree(nrt);
@ -161,7 +161,7 @@ route_delete(unsigned int rid, sa_family_t af, char *string)
rt = rtable_lookup(0, dst, mask, NULL, RTP_ANY);
if (rt == NULL) {
inet_net_satop(af, dst, plen, ip, sizeof(ip));
errx(1, "can't find route: %s\n", ip);
errx(1, "can't find route: %s", ip);
}
assert(memcmp(rt_key(rt), dst, dst->sa_len) == 0);
@ -169,7 +169,7 @@ route_delete(unsigned int rid, sa_family_t af, char *string)
if ((error = rtable_delete(0, dst, mask, rt)) != 0) {
inet_net_satop(af, dst, plen, ip, sizeof(ip));
errx(1, "can't rm route: %s, %s\n", ip, strerror(error));
errx(1, "can't rm route: %s, %s", ip, strerror(error));
}
nrt = rtable_lookup(0, dst, mask, NULL, RTP_ANY);
@ -207,7 +207,7 @@ route_lookup(unsigned int rid, sa_family_t af, char *string)
rt = rtable_lookup(0, dst, mask, NULL, RTP_ANY);
if (rt == NULL) {
inet_net_satop(af, dst, plen, ip, sizeof(ip));
errx(1, "%s not found\n", ip);
errx(1, "%s not found", ip);
}
assert(memcmp(rt_key(rt), dst, dst->sa_len) == 0);
assert(rt_plen(rt) == rtable_satoplen(af, mask));
@ -225,7 +225,7 @@ do_from_file(unsigned int rid, sa_family_t af, char *filename,
int lines = 0;
if ((fp = fopen(filename, "r")) == NULL)
errx(1, "No such file: %s\n", filename);
errx(1, "No such file: %s", filename);
while ((buf = fgetln(fp, &len)) != NULL) {
if (buf[len - 1] == '\n')
@ -264,7 +264,7 @@ rtentry_delete(struct rtentry *rt, void *w, unsigned int rid)
if ((error = rtable_delete(0, rt_key(rt), mask, rt)) != 0) {
inet_net_satop(af, rt_key(rt), rt_plen(rt), dest, sizeof(dest));
errx(1, "can't rm route: %s, %s\n", dest, strerror(error));
errx(1, "can't rm route: %s, %s", dest, strerror(error));
}
assert(refcnt_read(&rt->rt_refcnt) == 0);

View File

@ -1,4 +1,4 @@
/* $Id: test-ip.c,v 1.10 2024/04/22 05:54:01 claudio Exp $ */
/* $Id: test-ip.c,v 1.11 2024/08/23 12:56:26 anton Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@ -59,7 +59,7 @@ test(const char *res, uint16_t afiv, size_t sz, size_t unused, ...)
addr.prefixlen = sz * 8 - unused;
ip_addr_print(&addr, afi, buf, sizeof(buf));
if (res != NULL && strcmp(res, buf))
errx(EXIT_FAILURE, "fail: %s != %s\n", res, buf);
errx(EXIT_FAILURE, "fail: %s != %s", res, buf);
else if (res != NULL)
warnx("pass: %s", buf);
else