New blog post: Errors from `close`.
Following up on my enormously(?) popular blog post about bugs in hello world, I dive into the electrifying topic of whether the fixed version still has a bug lurking. 🐛
New blog post: Errors from `close`.
Following up on my enormously(?) popular blog post about bugs in hello world, I dive into the electrifying topic of whether the fixed version still has a bug lurking. 🐛
@sunfish Wouldn't the problem of dup-then-close being ignored due to reference counting also apply on the file descriptors passed by the shell? (Which effectively does open/fd-pass/close for redirections)
Also for me calling close on files explicitly opened makes sense, while calling close on passed fds feels weird although exit(), implied for returns from main, closes all open streams. (cf. ISO C)
> Wouldn't the problem [...] also apply on the file descriptors passed by the shell?
The shell closes its own fd after doing the `dup2`, so the reference count would go back to 1 before the fd is passed to the new application.
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.