aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen/Makefile.inc
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2016-08-12 07:03:58 +0000
committerEd Schouten <ed@FreeBSD.org>2016-08-12 07:03:58 +0000
commite2f68161004f312bf10e4b683ac866b45f6e8489 (patch)
treea50cc6fc0fb7585fae31392699626146ed813198 /lib/libc/gen/Makefile.inc
parent791444089f5dd584327e2e79b58e016796f02ad5 (diff)
downloadsrc-e2f68161004f312bf10e4b683ac866b45f6e8489.tar.gz
src-e2f68161004f312bf10e4b683ac866b45f6e8489.zip
Reimplement dirname(3) to be thread-safe.
Now that we've updated the prototypes of the basename(3) and dirname(3) functions to conform to POSIX, let's go ahead and reimplement dirname(3) in such a way that it's thread-safe, but also guaranteed to succeed. C libraries like glibc, musl and the one that's part of Solaris already follow such an approach. Move the existing implementation to another source file, freebsd11_dirname.c to keep existing users of the API that pass in a constant string happy, using symbol versioning. Put a new version of the function in dirname.c, obtained from CloudABI's C library. This version scans through the pathname string from left to right, normalizing it, while discarding the last pathname component. Reviewed by: emaste, jilles Differential Revision: https://reviews.freebsd.org/D7355
Notes
Notes: svn path=/head/; revision=303988
Diffstat (limited to 'lib/libc/gen/Makefile.inc')
-rw-r--r--lib/libc/gen/Makefile.inc1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 696d907ac609..58f582fb4e73 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -29,6 +29,7 @@ SRCS+= __getosreldate.c \
devname.c \
dirfd.c \
dirname.c \
+ dirname_compat.c \
disklabel.c \
dlfcn.c \
drand48.c \