Fixing build on MinGW

- Windows has no concept of group permissions nor other permissions on
files, therefore the code needed to be adjusted.

- There is no fcntl(...) system call in Windows.

- fsync(...) does not exist in Windows.