On Wed, 24 Apr 2019 00:01:08 +0700, Robert Elz said:
I don't know why fd 3 was wanted to be a dup of stdin, but aside from
that oddity, there's notthing remarkable about the code (no WTF), the
test is just avoiding a (pointless) dup2(3,3).
Whatever fd 3 was before executing this code, it is closed after it
unless it happened to be what is wanted on stdin.
The point is that the fragment of code doesn't actually *know* "it happened
to be what is wanted on stdin". For all this code knows, it's a dangling fd
that was opened by some library function to talk to dbus or something.
--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers