HomeFreeBSD

touch: don't leak descriptor if fstat(2) fails

Description

touch: don't leak descriptor if fstat(2) fails

If fstat(2) fails the close(2) won't be called, which will leak the
file descriptor.

The idea was borrowed from OpenBSD, where similar patch
was applied for futimens(2).

MFC after: 1 week

(cherry picked from commit cb54c500d0e1a2c52270b15c6db6a88ca3feb86a)

Details

Provenance
oshogboAuthored on Mar 12 2022, 10:38 AM
Parents
rG4a11315a2c3f: virtio_random(8): MFC: avoid deadlock at shutdown time (regression fix)
Branches
Unknown
Tags
Unknown