Use getcwd() instead of get_current_dir_name().
[tinc] / src / cygwin /
drwxr-xr-x   ..
-rw-r--r-- 7184 device.c