The problem is that any third-party library functions that you call need to know about and use
this lock. Or, you need to hold a lock around the entire library function call.
Personally I'd be happy to just make close-on-exec the default, though no doubt other people
have code that would be broken by that.