Eliminate the last user of basename_r() in the base system.
In this case it's fairly easy to make use of basename().