libbsd: Branch 'main'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jan 7 16:56:55 UTC 2024


 configure.ac         |    5 +++++
 include/bsd/string.h |    3 ++-
 man/strlcpy.3bsd     |    7 ++++---
 3 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit df116b5597ae1b17b5b31834c6c082d57ddf94d4
Author: Guillem Jover <guillem at hadrons.org>
Date:   Sun Jan 7 17:43:12 2024 +0100

    Adjust strlcpy() and strlcat() per glibc adoption
    
    These functions were added in glibc 2.38, in anticipation of POSIX
    adopting them too.
    
    Closes: #26

diff --git a/configure.ac b/configure.ac
index 8ff2bef..aea61ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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.
diff --git a/include/bsd/string.h b/include/bsd/string.h
index 1996697..64b4e13 100644
--- a/include/bsd/string.h
+++ b/include/bsd/string.h
@@ -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
diff --git a/man/strlcpy.3bsd b/man/strlcpy.3bsd
index ebc9758..c3eee4f 100644
--- a/man/strlcpy.3bsd
+++ b/man/strlcpy.3bsd
@@ -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.


More information about the libbsd mailing list