refs.c: make remove_empty_directories always set errno to something sane