https://bugs.openldap.org/show_bug.cgi?id=10012
--- Comment #3 from Howard Chu hyc@openldap.org --- (In reply to balaev from comment #2)
(In reply to Howard Chu from comment #1)
Who cares? The fcntl call would just fail with EBADF.
Some static analyzers (for example, svace) generate warnings on such code. In fact, yes, there is no problem as such. It just performs a meaningless action in case socket(2) fails.
Yes, the likelihood of which is near zero on a typical system. It would mean the system was out of memory, or file descriptors, or some other resource exhaustion which almost never happens in practice, and if it does happen, far worse things will be failing on the machine.
When was the last time you've even heard of socket() failing?