From nobody Fri Feb 03 15:58:02 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 4P7gKp4Mfhz3kSnt; Fri, 3 Feb 2023 15:58:06 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4P7gKp05Qlz3kRj; Fri, 3 Feb 2023 15:58:05 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Authentication-Results: mx1.freebsd.org; none Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 313Fw2Vk051541; Fri, 3 Feb 2023 07:58:02 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 313Fw2sJ051540; Fri, 3 Feb 2023 07:58:02 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202302031558.313Fw2sJ051540@gndrsh.dnsmgr.net> Subject: Re: git: cb96a0ef0040 - main - cp: Minor code cleanup. In-Reply-To: <202302031537.313FbfF0099172@gitrepo.freebsd.org> To: =?UTF-8?Q?Dag-Erling_Sm=C3=B8rgrav?= Date: Fri, 3 Feb 2023 07:58:02 -0800 (PST) CC: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4P7gKp05Qlz3kRj X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N > The branch main has been updated by des: > > URL: https://cgit.FreeBSD.org/src/commit/?id=cb96a0ef0040fa7968245ab203ab70a7ed2d275d > > commit cb96a0ef0040fa7968245ab203ab70a7ed2d275d > Author: Dag-Erling Sm?rgrav > AuthorDate: 2023-02-03 15:37:24 +0000 > Commit: Dag-Erling Sm?rgrav > CommitDate: 2023-02-03 15:37:37 +0000 > > cp: Minor code cleanup. > > * Fix includes in utils.c, cf. style(9). > * Fix type mismatch: readlink(2) returns ssize_t, not int. > * It is not necessary to set errno to 0 as fts_read(3) already does it. > > MFC after: 1 week > Sponsored by: Klara, Inc. > Reviewed by: allanjude > Differential Revision: https://reviews.freebsd.org/D38369 > --- > bin/cp/cp.c | 3 +-- > bin/cp/utils.c | 5 ++--- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/bin/cp/cp.c b/bin/cp/cp.c > index dbae4b535843..e38cd97f4369 100644 > --- a/bin/cp/cp.c > +++ b/bin/cp/cp.c > @@ -311,8 +311,7 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat) > recurse_path = NULL; > if ((ftsp = fts_open(argv, fts_options, NULL)) == NULL) > err(1, "fts_open"); > - for (badcp = rval = 0; errno = 0, (curr = fts_read(ftsp)) != NULL; > - badcp = 0) { > + for (badcp = rval = 0; (curr = fts_read(ftsp)) != NULL; badcp = 0) { Wouldnt it now be possible for code in the fts_read path to reference errno unintialized? > switch (curr->fts_info) { > case FTS_NS: > case FTS_DNR: > diff --git a/bin/cp/utils.c b/bin/cp/utils.c > index a3a498714f43..8c1c350ff6f1 100644 > --- a/bin/cp/utils.c > +++ b/bin/cp/utils.c > @@ -37,9 +37,8 @@ static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94"; > #include > __FBSDID("$FreeBSD$"); > > -#include > -#include > #include > +#include > #include > > #include > @@ -241,7 +240,7 @@ done: > int > copy_link(const FTSENT *p, int exists) > { > - int len; > + ssize_t len; > char llink[PATH_MAX]; > > if (exists && nflag) { > -- Rod Grimes rgrimes@freebsd.org