Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Feb 2023 10:11:36 -0600
From:      Kyle Evans <kevans@freebsd.org>
To:        =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= <des@freebsd.org>
Cc:        "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net>, rgrimes@freebsd.org,  src-committers@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org
Subject:   Re: git: cb96a0ef0040 - main - cp: Minor code cleanup.
Message-ID:  <CACNAnaFF_yQDtdnDtUr7wz4NPsCmG5ODASopm8YvmZ_GF2TK2w@mail.gmail.com>
In-Reply-To: <86lele3f6c.fsf@ltc.des.no>
References:  <202302031558.313Fw2sJ051540@gndrsh.dnsmgr.net> <86lele3f6c.fsf@ltc.des.no>

index | next in thread | previous in thread | raw e-mail

On Fri, Feb 3, 2023 at 10:08 AM Dag-Erling Smørgrav <des@freebsd.org> wrote:
>
> "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net> writes:
> > Wouldnt it now be possible for code in the fts_read path to reference
> > errno unintialized?
>
> Can you provide a test case?
>
> We (cp) only look at errno if fts_read() returns NULL, and that only
> happens after an error (errno is expected to be set) or when we're done
> (fts_read() explicitly sets errno to 0).
>

fts_read() doesn't always set errno to 0; notably, there's a number of
FCHDIR() paths that don't set errno (and the change that added it
mentions that scenario exactly) and will return NULL because of an
error.


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaFF_yQDtdnDtUr7wz4NPsCmG5ODASopm8YvmZ_GF2TK2w>