/[base]
ViewVC logotype

Revision 308264


Jump to revision: Previous Next
Author: ed
Date: Thu Nov 3 20:21:34 2016 UTC (7 years, 8 months ago)
Changed paths: 6
Log Message:
Replace basename(3) by a thread-safe implementation.

Now that the changes to the dirname(3) function had some time to settle,
let's go ahead and use the same approach for replacing basename(3) by a
simple implementation that modifies the input string, thereby making it
thread-safe and guaranteed to succeed.

Unlike dirname(3), this function already had a thread-safe variant
basename_r(3). This function had its own set of problems, like having an
upper bound on the pathname length. Keep this function around for
compatibility, but remove most references from the man page. Make the
man page more similar to that of dirname(3).

As the basename_r(3) function is only provided by FreeBSD (and Bionic),
depending on its use is even more implementation defined than assuming
that basename(3) is thread-safe.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D8382


Changed paths

Path Details
Directoryhead/include/libgen.h modified , text changed
Directoryhead/lib/libc/gen/Makefile.inc modified , text changed
Directoryhead/lib/libc/gen/Symbol.map modified , text changed
Directoryhead/lib/libc/gen/basename.3 modified , text changed
Directoryhead/lib/libc/gen/basename.c modified , text changed
Directoryhead/lib/libc/gen/basename_compat.c
(Copied from head/lib/libc/gen/basename.c, r306522)
added , text changed

  ViewVC Help
Powered by ViewVC 1.1.27