]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Adjust strlcpy() and strlcat() per glibc adoption
authorGuillem Jover <guillem@hadrons.org>
Sun, 7 Jan 2024 16:43:12 +0000 (17:43 +0100)
committerGuillem Jover <guillem@hadrons.org>
Sun, 7 Jan 2024 16:55:40 +0000 (17:55 +0100)
These functions were added in glibc 2.38, in anticipation of POSIX
adopting them too.

Closes: #26
configure.ac
include/bsd/string.h
man/strlcpy.3bsd

index 8ff2bef0c944281656fc40f0c30d572df6b61847..aea61ab752fad9c04564ac93bb911703757faf71 100644 (file)
@@ -267,6 +267,11 @@ need_id_from_name=yes
 need_fpurge=yes
 need_funopen=yes
 AS_CASE([$host_os],
+  [*-gnu*], [
+    # On glibc >= 2.38, strlcpy() and strlcat() got added,
+    # so these could then be dropped on the next SOVERSION bump.
+    #need_strl=no
+  ],
   [*-musl*], [
     # On musl >= 0.5.0, strlcpy() and strlcat() were already implemented,
     # so these can then be dropped on the next SOVERSION bump.
index 1996697d2a3305da4635c29a0bf84c0451a1ea4b..64b4e13bcd7ca2bb8ba75c7a6546508ab114fab1 100644 (file)
@@ -41,7 +41,8 @@
 #include <sys/types.h>
 
 __BEGIN_DECLS
-#ifndef __APPLE__
+#if !defined(__APPLE__) && \
+    (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 38) || !defined(_DEFAULT_SOURCE))
 size_t strlcpy(char *dst, const char *src, size_t siz);
 size_t strlcat(char *dst, const char *src, size_t siz);
 #endif
index ebc9758fb95f7bd932bdb3fb37befca2f60124f4..c3eee4fad337d16927f6ecd3f505dcfa49f9d4b6 100644 (file)
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: January 7 2024 $
 .Dt strlcpy 3bsd
 .Os
 .Sh NAME
@@ -192,6 +192,7 @@ and
 functions first appeared in
 .Ox 2.4 ,
 and made their appearance in
-.Nx 1.4.3
+.Nx 1.4.3 ,
+.Fx 3.3
 and
-.Fx 3.3 .
+glibc 2.38.