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