NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/58162: close(2) man page doesn't guarantee fd is closed even on EINTR



>Number:         58162
>Category:       kern
>Synopsis:       close(2) man page doesn't guarantee fd is closed even on EINTR
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 17 15:55:01 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, 8
>Organization:
The NetBSD Foundation: close: Interrupted system call
>Environment:
>Description:
The close(2) system call as implemented unconditionally closes the file descriptor, and, if it was the last descriptor for an underlying file, otherwise-unconditionally closes that file.

However, the close(2) man page doesn't guarantee that, and POSIX leaves it unspecified:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
https://www.daemonology.net/blog/2011-12-17-POSIX-close-is-broken.html

We should commit to this guarantee in the man page, because it is obviously the right thing to do even if POSIX allows insensible implementations.

Same deal with closedir(3): https://pubs.opengroup.org/onlinepubs/9699919799/functions/closedir.html
>How-To-Repeat:
man close
https://man.netbsd.org/close.2

man closedir
https://man.netbsd.org/closedir.3
>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index