Page MenuHomeFreeBSD

Stop using the non-standard basename_r() function.
ClosedPublic

Authored by ed on May 29 2016, 9:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 22 2024, 8:44 PM
Unknown Object (File)
Mar 22 2024, 8:44 PM
Unknown Object (File)
Mar 22 2024, 8:44 PM
Unknown Object (File)
Mar 9 2024, 7:32 AM
Unknown Object (File)
Jan 4 2024, 12:10 PM
Unknown Object (File)
Jan 4 2024, 12:10 PM
Unknown Object (File)
Jan 4 2024, 12:10 PM
Unknown Object (File)
Jan 4 2024, 2:16 AM
Subscribers

Details

Summary

This change makes the code use the POSIX basename() function. It has the
advantage that (if implemented correctly), it also imposes no restrict
on the pathname length.

Notice that I haven't added any error handling to the strdup() call. It
looks like none of the other calls to strdup() and malloc() performed by
this utility do it either.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ed retitled this revision from to Stop using the non-standard basename_r() function..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added reviewers: hrs, gjb.
hrs edited edge metadata.

Looks good to me. Do we need strdup(), BTW? I think FreeBSD's basename() does not change
memory area where name points though SUS says it may be changed.

This revision is now accepted and ready to land.May 31 2016, 4:05 AM
In D6626#140418, @hrs wrote:

Looks good to me. Do we need strdup(), BTW? I think FreeBSD's basename() does not change
memory area where name points though SUS says it may be changed.

My plan is to switch over to the POSIX prototype in 12.0-CURRENT. ;-)

In D6626#140434, @ed wrote:
In D6626#140418, @hrs wrote:

Looks good to me. Do we need strdup(), BTW? I think FreeBSD's basename() does not change
memory area where name points though SUS says it may be changed.

My plan is to switch over to the POSIX prototype in 12.0-CURRENT. ;-)

Ah, I see. So please go ahead with your original patch.

This revision was automatically updated to reflect the committed changes.