A file descriptor closer that uses HANDLE_EINTR.
- A new flavor of ScopedFdCloser which wraps close() with HANDLE_EINTR,
which will retry closing the file descriptor if the last close attempt
was interrupted by EINTR. This appears to be a recommended practice
per POSIX documentation.
- Both ScopedFdCloser and ScopedEintrSafeFdCloser ensure a successful
close() prior to resetting the file descriptor.
- Better use of HANDLE_EINTR elsewhere: just realized that this macro
returns the value of the last evaluation of its argument.
BUG=chromium-os:25397
TEST=Image builds properly; GPIO functionality works (x86-alex).
Change-Id: I3425bb580499c7138cd31917011662d33ffab8a6
Reviewed-on: https://gerrit.chromium.org/gerrit/17079
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
2 files changed