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)
Tue, Dec 10, 1:06 PM
Unknown Object (File)
Sep 29 2024, 12:03 AM
Unknown Object (File)
Sep 20 2024, 1:54 PM
Unknown Object (File)
Sep 17 2024, 1:49 PM
Unknown Object (File)
Sep 9 2024, 12:42 AM
Unknown Object (File)
Sep 8 2024, 3:29 PM
Unknown Object (File)
Sep 8 2024, 2:00 AM
Unknown Object (File)
Aug 9 2024, 11:13 PM
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.