HomeFreeBSD

comm: close a race condition when comm is fed from stdin

Description

comm: close a race condition when comm is fed from stdin

If one of the files has ended, we won't show the column, but we still
need to drain the file pointer to avoid potentially hitting a pipe
failure.

This commit moves the NULL offset checks inside show() so that getline()
and ferror() are still called on fp.

Reviewed by: allanjude
Sponsored by: Apple Inc.
Differential Revision: https://reviews.freebsd.org/D45440

Details

Provenance
ccecchi_apple.comAuthored on Jun 6 2024, 4:51 PM
allanjudeCommitted on Jun 6 2024, 5:04 PM
Reviewer
allanjude
Differential Revision
D45440: comm: close a race condition when comm is fed from stdin
Parents
rG63f5c101a1fd: comm: flush stdout for error checking prior to exiting
Branches
Unknown
Tags
Unknown