aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2016-11-03 20:21:34 +0000
committerEd Schouten <ed@FreeBSD.org>2016-11-03 20:21:34 +0000
commit34168b28e99b0bb328c7bb49cd91cb942181056f (patch)
treed87ccf079f0846f66d2897554768fb78925732fa /include
parent1bec4c5b3d970c741ffcb08a40080924e6ce97af (diff)
Notes
Diffstat (limited to 'include')
-rw-r--r--include/libgen.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/include/libgen.h b/include/libgen.h
index 5b79f3619d80..173190f03674 100644
--- a/include/libgen.h
+++ b/include/libgen.h
@@ -40,21 +40,24 @@ char *dirname(char *);
__END_DECLS
/*
- * In FreeBSD 12, the prototype of dirname() was modified to comply to
- * POSIX. This function may now modify its input. Unfortunately, our
- * copy of xinstall(8) shipped with previous versions of FreeBSD is
- * built using the host headers and libc during the bootstrapping phase
- * and depends on the old behavior.
+ * In FreeBSD 12, the prototypes of basename() and dirname() were
+ * modified to comply to POSIX. These functions may now modify their
+ * input. Unfortunately, our copy of xinstall(8) shipped with previous
+ * versions of FreeBSD is built using the host headers and libc during
+ * the bootstrapping phase and depends on the old behavior.
*
- * Apply a workaround where we explicitly link against dirname@FBSD_1.0
- * in case this function is called on constant strings, instead of
- * making the program crash at runtime.
+ * Apply a workaround where we explicitly link against basename@FBSD_1.0
+ * and dirname@FBSD_1.0 in case these functions are called on constant
+ * strings, instead of making the program crash at runtime.
*/
#if defined(__generic) && !defined(__cplusplus)
__BEGIN_DECLS
+char *__old_basename(char *);
char *__old_dirname(char *);
__END_DECLS
+__sym_compat(basename, __old_basename, FBSD_1.0);
__sym_compat(dirname, __old_dirname, FBSD_1.0);
+#define basename(x) __generic(x, const char *, __old_basename, basename)(x)
#define dirname(x) __generic(x, const char *, __old_dirname, dirname)(x)
#endif