libbsd: Branch 'main' - 5 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 5 20:31:56 UTC 2022


 include/bsd/stdlib.h    |   12 +++++++++---
 include/bsd/string.h    |    3 ++-
 man/libbsd.7            |    6 +++---
 man/setproctitle.3bsd   |    2 +-
 src/setproctitle_ctor.c |    2 +-
 5 files changed, 16 insertions(+), 9 deletions(-)

New commits:
commit 03fccd150512ad22c9e27e5d597bf02190ee93cf
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Oct 5 12:08:31 2022 +0200

    include: Adjust reallocarray() per glibc adoption
    
    On glibc 2.29 reallocarray() was moved to _DEFAULT_SOURCE.
    
    Closes: !20
    Based-on-patch-by: Callum Farmer <gmbr3 at opensuse.org>
    Signed-off-by: Guillem Jover <guillem at hadrons.org>

diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
index ac60dc6..5732fd1 100644
--- a/include/bsd/stdlib.h
+++ b/include/bsd/stdlib.h
@@ -77,7 +77,8 @@ int sradixsort(const unsigned char **base, int nmemb,
 void *reallocf(void *ptr, size_t size);
 #if !defined(__GLIBC__) || \
     !__GLIBC_PREREQ(2, 26) || \
-    !defined(_GNU_SOURCE)
+    (__GLIBC_PREREQ(2, 26) && !__GLIBC_PREREQ(2, 29) && !defined(_GNU_SOURCE)) || \
+    (__GLIBC_PREREQ(2, 29) && !defined(_DEFAULT_SOURCE))
 void *reallocarray(void *ptr, size_t nmemb, size_t size);
 #endif
 void *recallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size);
commit 6b6e686b23214ef37c30d5e1568156ba18e76f29
Author: Callum Farmer <gmbr3 at opensuse.org>
Date:   Wed Oct 5 12:08:31 2022 +0200

    include: Adjust arc4random() per glibc adoption
    
    Some arc4random functions were added in glibc 2.36.
    
    Signed-off-by: Callum Farmer <gmbr3 at opensuse.org>
    Signed-off-by: Guillem Jover <guillem at hadrons.org>

diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
index f7bcbd0..ac60dc6 100644
--- a/include/bsd/stdlib.h
+++ b/include/bsd/stdlib.h
@@ -51,11 +51,15 @@
 #include <stdint.h>
 
 __BEGIN_DECLS
+#if !defined(__GLIBC__) || \
+    !__GLIBC_PREREQ(2, 36) || \
+    !defined(_DEFAULT_SOURCE)
 uint32_t arc4random(void);
-void arc4random_stir(void);
-void arc4random_addrandom(unsigned char *dat, int datlen);
 void arc4random_buf(void *_buf, size_t n);
 uint32_t arc4random_uniform(uint32_t upper_bound);
+#endif
+void arc4random_stir(void);
+void arc4random_addrandom(unsigned char *dat, int datlen);
 
 int dehumanize_number(const char *str, int64_t *size);
 
commit da1f45ac71ac0db7f2ad48fd3dbf24e719723ee1
Author: Callum Farmer <gmbr3 at opensuse.org>
Date:   Mon Oct 3 16:09:18 2022 +0100

    include: explicit_bzero() requires _DEFAULT_SOURCE
    
    Signed-off-by: Callum Farmer <gmbr3 at opensuse.org>
    Signed-off-by: Guillem Jover <guillem at hadrons.org>

diff --git a/include/bsd/string.h b/include/bsd/string.h
index d03c755..4f2b71c 100644
--- a/include/bsd/string.h
+++ b/include/bsd/string.h
@@ -48,7 +48,7 @@ void strmode(mode_t mode, char *str);
 
 #if !defined(__GLIBC__) || \
     !__GLIBC_PREREQ(2, 25) || \
-    !defined(_GNU_SOURCE)
+    !defined(_DEFAULT_SOURCE)
 void explicit_bzero(void *buf, size_t len);
 #endif
 __END_DECLS
commit 2f9eddc277187e25167331ae3bde4a491fd87fa2
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Oct 5 02:05:46 2022 +0200

    include: Simplify glibc version dependent macro handling
    
    We test once whether __GLIBC__ is not defined, so we do not need to test
    whether it is on the OR branch afterwards. We decouple the glibc version
    restriction check from the _*_SOURCE variable, as that contains an
    implicit opposite version check.

diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
index 2bee974..f7bcbd0 100644
--- a/include/bsd/stdlib.h
+++ b/include/bsd/stdlib.h
@@ -72,7 +72,8 @@ int sradixsort(const unsigned char **base, int nmemb,
 
 void *reallocf(void *ptr, size_t size);
 #if !defined(__GLIBC__) || \
-    (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 26) || !defined(_GNU_SOURCE)))
+    !__GLIBC_PREREQ(2, 26) || \
+    !defined(_GNU_SOURCE)
 void *reallocarray(void *ptr, size_t nmemb, size_t size);
 #endif
 void *recallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size);
diff --git a/include/bsd/string.h b/include/bsd/string.h
index f987fee..d03c755 100644
--- a/include/bsd/string.h
+++ b/include/bsd/string.h
@@ -47,7 +47,8 @@ char *strnstr(const char *str, const char *find, size_t str_len);
 void strmode(mode_t mode, char *str);
 
 #if !defined(__GLIBC__) || \
-    (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 25) || !defined(_GNU_SOURCE)))
+    !__GLIBC_PREREQ(2, 25) || \
+    !defined(_GNU_SOURCE)
 void explicit_bzero(void *buf, size_t len);
 #endif
 __END_DECLS
commit 28298ac0372f320174eb591e0e2879abcc568521
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Oct 5 01:35:08 2022 +0200

    doc: Switch references from pkg-config to pkgconf
    
    The former used to be the reference implementation, but it has been
    stagnant to the point of not showing much signs of life. Switch to
    the currently active and more complete implementation for references.

diff --git a/man/libbsd.7 b/man/libbsd.7
index c9079ac..638caf8 100644
--- a/man/libbsd.7
+++ b/man/libbsd.7
@@ -42,7 +42,7 @@ The library can be used in an overlay mode, which is the preferred way, so
 that the code is portable and requires no modification to the original BSD
 code.
 This can be done easily with the
-.Xr pkg-config 1
+.Xr pkgconf 1
 library named
 .Pa libbsd-overlay .
 Or by adding the system-specific include directory with the
@@ -64,7 +64,7 @@ this is less portable as it makes using
 mandatory and it will not work on BSD-based systems, and requires
 modifying original BSD code.
 This can be done with the
-.Xr pkg-config 1
+.Xr pkgconf 1
 library named
 .Pa libbsd .
 The includes in this case should be namespaced with
@@ -79,7 +79,7 @@ program so that the
 .Fn setproctitle_init 3
 function gets invoked automatically at startup time.
 This can be done with the
-.Xr pkg-config 1
+.Xr pkgconf 1
 library named
 .Pa libbsd-ctor .
 .Sh HEADERS
diff --git a/man/setproctitle.3bsd b/man/setproctitle.3bsd
index 4d3290a..1a79088 100644
--- a/man/setproctitle.3bsd
+++ b/man/setproctitle.3bsd
@@ -54,7 +54,7 @@ library routine only needs to be called (before any call to
 and with
 .Fn main
 arguments), if the automatic constructor support has not
-been linked in through the libbsd-ctor pkg-config file.
+been linked in through the libbsd-ctor pkgconf file.
 .Pp
 The title is set from the executable's name, followed by the
 result of a
diff --git a/src/setproctitle_ctor.c b/src/setproctitle_ctor.c
index f25dbfc..d97de50 100644
--- a/src/setproctitle_ctor.c
+++ b/src/setproctitle_ctor.c
@@ -38,7 +38,7 @@
  *
  * To avoid any other possible fallout, the constructor is split into a
  * new static library that needs to be linked explicitly into programs
- * using setproctitle(). As an additional safety measure the pkg-config
+ * using setproctitle(). As an additional safety measure the pkgconf(1)
  * linker flags will mark the program as not allowing to be dlopen()ed
  * so that we make sure to avoid the problem described above.
  */


More information about the libbsd mailing list