From nobody Wed Nov 29 21:49:56 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SgXzm4SSbz52JQZ; Wed, 29 Nov 2023 21:49:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SgXzm3tXYz4n8t; Wed, 29 Nov 2023 21:49:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701294596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jxZim4aL+p+SokqZzU6u15J9k+f6aPm2WOFShkPThMs=; b=hypD1Kcb/kmgUqu9CnOwm6lEfZwAHyi6OIltXNVdihER8y6NSp3iXr0CN/5TQEtz1BshJX p/m/e6e78h2ADcMhVYXFEcOwOml90ST80RJqN51TAc2Shjwlp7EF+x0WMK3qHPkVBwAW++ 5q1U4iVTtSwhLtiTlqD9CmKmYpEX68ZDYH1nnSL6/2Tr7EITDAeOglKnYckmAOoZzbySsx YG2OVvQ4hVofbKwW3JAyIJfTzv47R8VvEGsP1HDxVx6qIdVsswJ8d7yeOVxsoVsEBNuYMK 9Jaog9A0hCld6D5ItnAifEJ1srkR0d80i/u9KyzBUp5hOWHUVN6EvQHc/iFNVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701294596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jxZim4aL+p+SokqZzU6u15J9k+f6aPm2WOFShkPThMs=; b=E0q6g7HRlGM/DoE2eqhVlz7QV86K7DTvw16JUcC8AsdKTw53Kh0oCdTe9bZgt8XV75LiBL GzcdqlIa22R84ltdhlzwG6a/O4lMGUymZgUP1JRMoQL8ANSCkNhKBUFdW+bqdi51w3M4NA KELLSWmxAaQpIMXgUcZ32CimxjZNQ6z+sh/DFaYy8X6hv5H5PEsquKd098B4un2i3Ia4C+ 0bLI+4vzPhslrfgrk8vQwSzrWiBpvYH1QaPvf5OlJNRBahbAVOBA/x06UHSXeHvpn2Fjsd yixHIsn9hcc37gNMjRKPqNshA9CBaWNOFC55JxI5lytBXlfnjXN6t5+TWjerHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701294596; a=rsa-sha256; cv=none; b=vbev1gbKnOKBV9PuAm9hJJm8WKsgbyjkVBiSSsYhRyMSmT5ATWJHp/j2hWU7Le78O6TtEw 3/HRj7D2teixMAYAbOnCcMLPIIcsQxSDCaMCu1rOQ/2E86RoVluG8OFZg3XneWC5sh6nGK AbeSYdL9LISUoEkyfygyN2fdRJ3SmALSmcgfc3vD7fqHqu2YKqcZBk8blD/3zcuq58yIX/ 8Ihxf/LAmRc82Z1kvPVj9A/eMNOwdGzWr4aqggeFptoht5TGS8bCsEp+scIz/UJEgjbQAj iSFVuoLEobZc020Wq/3G5tOYf9OeSBs1HWS0N6VEerN+439vXGTjyLFEU/zy6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SgXzm2z2Tz7Pq; Wed, 29 Nov 2023 21:49:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3ATLnuDQ066844; Wed, 29 Nov 2023 21:49:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ATLnuKU066841; Wed, 29 Nov 2023 21:49:56 GMT (envelope-from git) Date: Wed, 29 Nov 2023 21:49:56 GMT Message-Id: <202311292149.3ATLnuKU066841@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: b70e57be2cfe - main - tail: Clean up error messages. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b70e57be2cfe83ec9f410e2f317ea38aaac61a98 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=b70e57be2cfe83ec9f410e2f317ea38aaac61a98 commit b70e57be2cfe83ec9f410e2f317ea38aaac61a98 Author: Dag-Erling Smørgrav AuthorDate: 2023-11-29 21:48:57 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-11-29 21:49:44 +0000 tail: Clean up error messages. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D42842 --- usr.bin/tail/forward.c | 2 +- usr.bin/tail/read.c | 8 ++++---- usr.bin/tail/reverse.c | 2 +- usr.bin/tail/tail.c | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index a8f52ed376c4..800492d2b1f3 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -335,7 +335,7 @@ follow(file_info_t *files, enum STYLE style, off_t off) */ ev = malloc(no_files * 2 * sizeof(struct kevent)); if (ev == NULL) - err(1, "Couldn't allocate memory for kevents."); + err(1, "failed to allocate memory for kevents"); set_events(files); for (;;) { diff --git a/usr.bin/tail/read.c b/usr.bin/tail/read.c index 6561a235a73d..07db98d0def1 100644 --- a/usr.bin/tail/read.c +++ b/usr.bin/tail/read.c @@ -69,7 +69,7 @@ bytes(FILE *fp, const char *fn, off_t off) char *sp; if ((sp = p = malloc(off)) == NULL) - err(1, "malloc"); + err(1, "failed to allocate memory"); for (wrap = 0, ep = p + off; (ch = getc(fp)) != EOF;) { *p = ch; @@ -143,7 +143,7 @@ lines(FILE *fp, const char *fn, off_t off) int blen, cnt, recno, wrap; if ((llines = calloc(off, sizeof(*llines))) == NULL) - err(1, "calloc"); + err(1, "failed to allocate memory"); p = sp = NULL; blen = cnt = recno = wrap = 0; rc = 0; @@ -151,7 +151,7 @@ lines(FILE *fp, const char *fn, off_t off) while ((ch = getc(fp)) != EOF) { if (++cnt > blen) { if ((sp = realloc(sp, blen += 1024)) == NULL) - err(1, "realloc"); + err(1, "failed to allocate memory"); p = sp + cnt - 1; } *p++ = ch; @@ -160,7 +160,7 @@ lines(FILE *fp, const char *fn, off_t off) llines[recno].blen = cnt + 256; if ((llines[recno].l = realloc(llines[recno].l, llines[recno].blen)) == NULL) - err(1, "realloc"); + err(1, "failed to allocate memory"); } bcopy(sp, llines[recno].l, llines[recno].len = cnt); cnt = 0; diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c index 8be76eff9648..1fa8784dec6d 100644 --- a/usr.bin/tail/reverse.c +++ b/usr.bin/tail/reverse.c @@ -205,7 +205,7 @@ r_buf(FILE *fp, const char *fn) while ((tl = malloc(sizeof(bfelem_t))) == NULL) { first = TAILQ_FIRST(&head); if (TAILQ_EMPTY(&head)) - err(1, "malloc"); + err(1, "failed to allocate memory"); enomem += first->len; TAILQ_REMOVE(&head, first, entries); free(first); diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c index ce16e10b1be7..fc60a82287df 100644 --- a/usr.bin/tail/tail.c +++ b/usr.bin/tail/tail.c @@ -163,7 +163,7 @@ main(int argc, char *argv[]) cap_rights_set(&rights, CAP_EVENT); if (caph_rights_limit(STDIN_FILENO, &rights) < 0 || caph_limit_stderr() < 0 || caph_limit_stdout() < 0) - err(1, "can't limit stdio rights"); + err(1, "unable to limit stdio rights"); fa = fileargs_init(argc, argv, O_RDONLY, 0, &rights, FA_OPEN); if (fa == NULL) @@ -203,7 +203,7 @@ main(int argc, char *argv[]) if (*argv && fflag) { files = malloc(no_files * sizeof(struct file_info)); if (files == NULL) - err(1, "Couldn't malloc space for file descriptors."); + err(1, "failed to allocate memory for file descriptors"); for (filep = files; (fn = *argv++); filep++) { filep->file_name = fn; @@ -298,7 +298,7 @@ obsolete(char *argv[]) /* Malloc space for dash, new option and argument. */ len = strlen(*argv); if ((start = p = malloc(len + 3)) == NULL) - err(1, "malloc"); + err(1, "failed to allocate memory"); *p++ = '-'; /*