]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
fts_read: Handle error from a NULL return better.
authorbdrewery <bdrewery@FreeBSD.org>
Tue, 8 Dec 2020 23:38:26 +0000 (23:38 +0000)
committerbdrewery <bdrewery@FreeBSD.org>
Tue, 8 Dec 2020 23:38:26 +0000 (23:38 +0000)
commit7b51af1e7403d09126d2937841bae3be42c16f96
tree550fa72fe4f1d83dfdc72e6db29170e0e6940f77
parent387ed1c633ec2709a7f226434b485bf37cd70290
fts_read: Handle error from a NULL return better.

This is addressing cases such as fts_read(3) encountering an [EIO]
from fchdir(2) when FTS_NOCHDIR is not set.  That would otherwise be
seen as a successful traversal in some of these cases while silently
discarding expected work.

As noted in r264201, fts_read() does not set errno to 0 on a successful
EOF so it needs to be set before calling it.  Otherwise we might see
a random error from one of the iterations.

gzip is ignoring most errors and could be improved separately.

Reviewed by: vangyzen
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D27184
16 files changed:
bin/chflags/chflags.c
bin/chmod/chmod.c
bin/cp/cp.c
bin/ls/ls.c
bin/rm/rm.c
bin/setfacl/setfacl.c
contrib/mtree/create.c
contrib/mtree/verify.c
usr.bin/du/du.c
usr.bin/grep/util.c
usr.bin/gzip/gzip.c
usr.sbin/chown/chown.c
usr.sbin/ckdist/ckdist.c
usr.sbin/fmtree/create.c
usr.sbin/fmtree/verify.c
usr.sbin/setfmac/setfmac.c