fix dirname to handle input of form "foo/" correctly
[musl] / lib /
drwxr-xr-x   ..
-rw-r--r-- 0 empty