]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
pidfd_open.2: Close the pidfd in EXAMPLE
authorMichael Kerrisk <mtk.manpages@gmail.com>
Fri, 17 Jul 2020 07:13:31 +0000 (09:13 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Fri, 17 Jul 2020 07:13:31 +0000 (09:13 +0200)
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 <mtk.manpages@gmail.com>
man2/pidfd_open.2

index 1776700b01c16cb597483be45e7ef11901cef521..dc5232760d60f40e6ef5cd7b8d3028149ac30a00 100644 (file)
@@ -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