From 7cb61821b9d1ef399cc8261b159a6d92af0ceae2 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 17 Jul 2020 09:13:31 +0200 Subject: [PATCH] pidfd_open.2: Close the pidfd in EXAMPLE Close the PID file descriptor in the example program, to hint to the reader that like every other kind of file descriptor, a PID FD should be closed. Signed-off-by: Michael Kerrisk --- man2/pidfd_open.2 | 1 + 1 file changed, 1 insertion(+) diff --git a/man2/pidfd_open.2 b/man2/pidfd_open.2 index 1776700b0..dc5232760 100644 --- a/man2/pidfd_open.2 +++ b/man2/pidfd_open.2 @@ -256,6 +256,7 @@ main(int argc, char *argv[]) printf("Events (0x%x): POLLIN is %sset\en", pollfd.revents, (pollfd.revents & POLLIN) ? "" : "not "); + close(pidfd); exit(EXIT_SUCCESS); } .fi