Use getcwd() instead of get_current_dir_name().
[tinc] / bash_completion.d /
drwxr-xr-x   ..
-rw-r--r-- 3038 tinc