On Tue, 28 Jun 2016 21:46:30 -0700, Philip Guenther wrote:

> Inspired by espie@'s ttyname.c diff, here's a simplification of libc's
> fallback-to-scanning-/dev code for devname().  Since devname() returns
> the "name under /dev", this eliminates the string manipulation == win!
> 
> Works when tested with "stat -Lf %Sr" on a symlink to a device with
> /var/run/dev.db chmoded to 600.

Don't you need to make a copy of dp->d_name?  Returning dp->d_name
after closedir() seems dangerous.

Perhaps I should update my devname_r(3) diff...

 - todd

Reply via email to