Improve portability

As discussed by @lolilolicon in commit 0e854b1a7d278a386553a6a4feb34a9578d5aa74 this improves (POSIX) portability further