[Bug 262038] fts(3): Check for readdir(3) errors

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 11 Mar 2022 17:21:52 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262038

--- Comment #12 from Mahmoud Abumandour <ma.mandourr@gmail.com> ---
(In reply to Mark Johnston from comment #11)

Thanks for the feedback. I will address it and resend the patch.

Regarding setting readdir_errno only if readdir errs, how is this achievable
without setting errno to 0? From the man page:

    The function returns NULL upon reaching the end of the directory or on
error. In the event of an error, errno may be set to any of the values
documented for the getdirentries(2) system call.

Which I think means that we must set errno to 0 to distinguish whether a NULL
means error or "end of stream" indicator. Could you please elaborate more?
Maybe I can save errno and check that (ret == NULL && saved_errno != errno),
and if that's true then set readdir_errno?

-- 
You are receiving this mail because:
You are the assignee for the bug.