This requires fchmod(), which is not necessarily available everywhere. It also might not work at all. (It does work on Linux.)
This requires fchmod(), which is not necessarily available everywhere. It also might not work at all. (It does work on Linux.)