Log

Author Commit Date CI Message
Guillem Jover f20e6972 2017-06-05T06:43:22 man: Move all man pages to section 3bsd This should guarantee that even if the system provides or will provide native implementations of these functions, we will not have file conflicts.
Guillem Jover 07c76b66 2017-06-05T06:17:27 Do not use legacy BSD u_* types Some systems do not have these types available, and they are simply convenience aliases. Instead use the expanded versions which are more portable. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101192
Guillem Jover d6c35f61 2017-01-10T04:33:15 Do not provide funopen() on musl Fixes: https://bugs.debian.org/818246
Guillem Jover db7470b0 2017-01-10T04:27:25 Gracefully handle lack of system <sys/cdefs.h> This is the case on musl. Fixes: https://bugs.debian.org/810589
Guillem Jover e4475738 2017-01-20T02:20:12 Try <linux/a.out.h> if <a.out.h> is not present At least musl ships the former but not the latter.
Guillem Jover 368af99f 2016-08-28T17:13:20 Fix the __progname check to avoid the optimizer discarding the symbol Because we were assigning to another unused variable, when building the check with optimizations enabled, which is the default when using gcc as the compiler, the variable was being discarded. Instead pass it to printf() so that it cannot do so.
Guillem Jover 337e6202 2017-01-10T04:24:35 Support GCC deprecated attribute for GCC older than 4.5 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99190 Based-on-patch-by: Eric Smith <brouhaha@fedoraproject.org>
Guillem Jover 088f147e 2017-02-08T01:49:48 Add support for RISC-V
Helmut Grohne b2b1020d 2017-01-10T03:47:52 Add support for TileGX Fixes: https://bugs.debian.org/847560 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 9bed430e 2016-04-23T10:13:23 Release libbsd 0.8.3
Szabolcs Nagy cbfe0ebc 2016-03-27T12:37:09 Add missing <fcntl.h> includes These are required due to the O_* macro usage, but have passed undetected on glibc-based systems due to implicit inclusions. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover f3b566bd 2016-03-27T12:31:58 test: Add a unit test for md5
Guillem Jover e86c1b5f 2016-02-14T09:00:57 man: Fix ungrammatical construct Warned-by: lintian
Guillem Jover b7ce33cf 2016-02-12T22:56:09 build: Support clock_gettime() provided in librt In older glibc versions (< 2.17) clock_gettime() is in librt. Add a check for this to avoid build breakage for programs/libraries that use libbsd on such systems. Based-on-patch-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover ed84bec5 2016-02-10T10:38:51 Switch URLs from http or git to https
Guillem Jover cbe30577 2016-02-07T02:53:28 Fix file descriptor leak in HASHFileChunk helper This leak only happens on error conditions, so it's not too bad. Warned-by: coverity
Guillem Jover 5a32ea0a 2016-02-07T02:47:22 Fix unportable sizeof() usage We are calculating the size of the array, and need to pass the size of each element, not the size of a pointer to an element. Although this happens to be the same in many cases, this is not a portable assumption. Warned-by: coverity
Guillem Jover 2fb148a2 2016-01-27T15:25:23 Release libbsd 0.8.2
Hanno Boeck c8f0723d 2016-01-27T15:10:11 Fix heap buffer overflow in fgetwln() In the function fgetwln() there's a 4 byte heap overflow. There is a while loop that has this check to see whether there's still enough space in the buffer: if (!fb->len || wused > fb->len) { If this is true more memory gets allocated. However this test won't be true if wused == fb->len, but at that point wused already points out of the buffer. Some lines later there's a write to the buffer: fb->wbuf[wused++] = wc; This bug was found with the help of address sanitizer. Warned-by: ASAN Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93881 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Hanno Boeck 008316aa 2016-01-27T15:06:50 test: Add missing <sys/stat.h> include The test in test/strmode.c can fail to compile depending on the optimization flags used. The constants that are used in this file (S_IFREG etc.) come from the <sys/stat.h> include file. It seems gcc ignores this error if one compiles with "-O2" (default), but if one uses no optimization it fails. Add the missing include and it works all the time. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93880 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover e4ab2c62 2016-01-11T02:21:15 test: Fix success return code for arc4random unit test
Lukas Fleischer bf5573f8 2016-01-07T17:26:12 test: Fix race condition in headers-*.sh When running tests in parallel (e.g. using `make -j4 check`), the header tests currently fail due to headers-overlay.sh and headers-system.sh both generating headers-gen.c simultaneously, resulting in garbled output. Fix this by using separate C files for the tests. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 229f8579 2015-12-14T03:39:48 Release libbsd 0.8.1
Guillem Jover 7a756875 2015-12-14T03:03:57 Add support for GNU/Hurd to getentropy() Reuse the getentropy code for Linux on the Hurd, which has fallbacks for when the better interfaces are not present. And remove all the code that is not supported currently on the Hurd. Ideally the Hurd should get an equivalent interfaces that does not suffer from the same problems as /dev/urandom.
Guillem Jover f84004ba 2015-12-12T14:26:50 test: Add new unit tests for individual headers usage
Guillem Jover cdf998a0 2015-12-14T00:44:47 Turn <bsd/bsd.h> inert when using LIBBSD_OVERLAY Also print a warning stating this fact.
Guillem Jover 2c77ad59 2015-12-14T00:37:34 Add missing include to <md5.h> The header was not self-contained, it was missing definitions for some types included in <sys/types.h>.
Guillem Jover 48ac79b1 2015-12-12T14:27:12 Use the non-overlayed libbsd headers when we need our own definitions
Guillem Jover 290a1ce8 2015-12-07T02:40:46 Switch COPYING to Debian copyright machine readable format 1.0
Guillem Jover 6bcb1312 2015-12-07T02:45:52 Relicense my contribution to BSD-2-clause This avoids having two licenses on the same file.
Guillem Jover da137a09 2015-12-07T01:53:49 Add missing copyright and license headers
Guillem Jover d2f59a23 2015-12-02T04:00:58 Fix getentropy implementation to use the correct system hooks Include getentropy_<SYSTEM>.c instead of arc4random_<SYSTEM>.c.
Guillem Jover 01b77f0d 2015-12-02T03:32:13 Add support for GNU/kFreeBSD for closefrom() and getentropy()
Guillem Jover 75729394 2015-12-02T03:08:17 Unify most arc4random Unix hooks into a single file The Unix hook should work for most Unix-like systems, move glibc specific code there and a FreeBSd specific comment, and remove the rest. Also change the code to always fallback to use the generic Unix code. This should cover GNU/Hurd and GNU/kFreeBSD among others.
Guillem Jover 8493c7f2 2015-12-01T03:39:10 Use local SHA512 header Actually use the local private SHA512 header instead of relying on the OpenSSL one for no good reason. Add definition for expected macro SHA512_DIGEST_LENGTH.
Guillem Jover 2b030da0 2015-11-30T03:59:42 Release libbsd 0.8.0
Guillem Jover 330e2111 2015-11-30T03:53:21 Update license and copyright information
Guillem Jover 874a0e51 2015-09-23T19:39:47 Update arc4random module from OpenBSD and LibreSSL Rework arc4random_stir() and arc4random_addrandom() code over the new internal API, and documentation in the man page. Adapt the code to the local build system. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85827
Guillem Jover 9a9a8b2d 2015-09-23T19:39:47 Add private getentropy module from OpenBSD and LibreSSL Adapt the code to the local build system.
Guillem Jover 5f9265f8 2015-09-23T20:13:33 Add private SHA512 module from FreeBSD
Marek Vasut 1f77cdb4 2015-11-30T20:39:00 Add NIOS2 support to nlist() Add support for the NIOS2 soft-core CPU provided by Altera. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Guillem Jover <guillem@hadrons.org> Cc: Ley Foon Tan <lftan@altera.com> Cc: Thomas Chou <thomas@wytron.com.tw> Cc: Walter Goossens <waltergoossens@home.nl>
Guillem Jover f3b11554 2015-11-30T19:32:48 man: Rename funopen.3 to funopen.3bsd to avoid clash with funtools The funtools project ships a man page with the same, name. And although it mith probably make more sense to rename the man page there, as BSD systems will certainly not do so, this is the easiest and fastest way to avoid a file conflict.
Guillem Jover 877732ef 2015-11-30T23:48:17 test: Check asprintf() return code
Guillem Jover 02bccb0a 2015-09-30T04:17:15 test: Add unit test for strmode()
Guillem Jover 58bef83f 2015-11-16T01:12:24 test: Add unit test for arc4random()
Guillem Jover 6e074a2b 2015-11-30T23:00:35 build: Make git log invocation immune to local configuration
Guillem Jover 0871daf7 2015-11-30T04:12:02 build: Move hash/helper.c into new libbsd_la_included_sources Use this variable in EXTRA_DIST and libbsd_la_DEPENDENCIES.
Guillem Jover 02c33d50 2015-11-30T02:48:23 build: Move proctitle_LDFLAGS inside BUILD_LIBBSD_CTOR conditional
Guillem Jover 45443583 2015-09-23T19:37:37 Add explicit_bzero() function from OpenBSD
Guillem Jover 8641d8ae 2015-09-24T04:01:11 Make closefrom_procfs() fail when reallocarray() fails
Guillem Jover 34df1426 2014-11-05T20:01:53 Refactor file descriptor closure into a new closefrom_close()
Guillem Jover 3881c4fc 2014-11-02T00:23:00 Update closefrom() function Import from sudo. Adapt the build system to detect the required features.
Guillem Jover 3a3d87d7 2015-09-23T04:40:21 test: Add closefrom() unit test
Guillem Jover d62f7d8f 2014-11-01T00:55:55 test: Add test case for fpurge(NULL)
Guillem Jover cfb4d462 2014-11-01T00:54:09 test: Move and activate fpurge() test case from module to a dedicated file
Guillem Jover 205827a2 2014-11-01T00:52:42 build: Centralize testsuite LDADD setting in a single variable
Guillem Jover c7e01e98 2014-11-01T00:22:28 Sync queue(3) from FreeBSD Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85147
Guillem Jover 0982dcd9 2015-09-23T07:10:18 Lock the file streams in fgetln() and fparseln() The fparseln() function had the NetBSD uppercase macros stubbed out, so replace them with the actual stdio ones. The fgetln() function was missing any locking at all.
Guillem Jover ee26e59e 2015-09-23T05:50:52 Mark functions handling format strings with __printflike
Guillem Jover 151bc71d 2015-09-22T16:22:56 Add compile and link-time deprecation warnings for fgetln() Although the current implementation in libbsd is probably one of the safest ones around, it still poses some problems when used with many file streams. This function has now a replacement, that is both more standard and portable. Ask users to switch to getline(3) instead.
Guillem Jover 41ff37bb 2015-09-22T16:21:12 build: Add support for linker warnings
Guillem Jover 53d989a2 2014-12-13T21:28:36 Switch fparseln() implementation from fgetln() to getline()
Guillem Jover f50b197e 2015-09-22T22:30:17 test: Add fparseln() unit test
Guillem Jover 54f15341 2015-09-22T20:56:15 test: Refactor stream testing functions into a new module
Brent Cook 9688ab26 2014-12-13T08:55:59 Avoid left shift overflow in reallocarray Some 64-bit platforms (e.g. Windows 64) have a 32-bit long. So, shifting 1UL 32-bits to the left causes an overflow. This replaces the constant 1UL with (size_t)1 so that we get the correct constant size for the platform. Import from OpenBSD. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 025b4480 2014-11-04T05:34:46 Make mergesort setup() static
Guillem Jover a6a101ef 2014-11-04T05:33:26 Use ANSI C prototypes
Guillem Jover 32388fe5 2014-11-03T23:21:52 Use reallocarray() instead of malloc() or realloc()
Guillem Jover 30e328cb 2014-11-03T00:43:27 Do not close file descriptors while scanning the /proc filesystem Closing file descriptors changes the content of the fd directories in the /proc filesystem, which means readdir() might get very confused. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85663
Guillem Jover 4cc43915 2014-11-02T23:58:23 Move procfs based implementation into a new closefrom_procfs() function
Guillem Jover 32671144 2014-11-01T00:21:30 Add __offsetof, __rangeof and __containerof to sys/cdefs.h Import and adapt from FreeBSD.
Guillem Jover 0e4e3ab2 2014-11-01T00:20:23 Add __DECONST, __DEVOLATILE and __DEQUALIFY macros to sys/cdefs.h Import from FreeBSD.
Guillem Jover a6fe103c 2014-10-31T17:29:54 Add new man page for reallocarray(3) Import man page from OpenBSD. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85622
Guillem Jover 02b55488 2014-08-12T12:32:34 Use stdint integer types instead of BSD legacy ones
Callum Davies 63783511 2014-08-10T12:34:44 Fix arc4random() and arc4random_stir() prototypes These two functions accept no arguments. The prototypes should reflect this. This change lets the compiler warn about certain (admittedly silly) mistakes. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover e390651b 2014-07-29T03:00:08 Release libbsd 0.7.0
Guillem Jover e8d3d041 2014-07-20T01:48:20 build: Remove hard requirement for GNU .init_array section support In case the support is not available, just stop building the libbsd-ctor.a library, which is a nice to have thing, but should not have been a hard requirement from the start. This should allow to build libbsd on non-glibc based systems using another libc.
Benjamin Baier faa005cb 2014-06-27T02:05:11 Add reallocarray() function from OpenBSD Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 36aca8c0 2014-06-26T21:43:55 Add stringlist module from NetBSD
Guillem Jover e8f93003 2014-06-26T21:32:11 Add getbsize() function Import code from DragonFlyBSD and man page from FreeBSD.
Christian Svensson a88bb838 2014-03-06T22:10:36 Add OpenRISC support to nlist() Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 8d16c3df 2013-10-11T05:43:42 Add timeconv module from FreeBSD Inline license information from FreeBSD root dir COPYRIGHT file.
Guillem Jover f41fdcf1 2013-10-21T05:07:56 Add funopen() function This is a wrapper over the glibc fopencookie() function. We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations, because seekfn() there wrongly uses fpos_t, assuming it's an integral type, and any code using that on a system where fpos_t is a struct (such as GNU-based systems or NetBSD) will fail to build. In which case, as the code has to be modified anyway, we might just as well use the correct declaration.
Guillem Jover 86cbff38 2013-10-11T05:11:42 Handle glibc partial header inclusions The glibc headers use selective inclusions through the __need_NAME mechanism to avoid circular dependencies. The problem is that if we are being overlaid, and have been requested a partial inclusion, when we pass control to the system header, then we might miss definitions needed by our own header, resulting in build failures. Workaround that by catching current partial requests, and skip the current inclusion.
Guillem Jover ee04e8de 2013-10-10T09:49:04 build: Set subdir-objects automake option Bump automake minimal version to 1.9.
Guillem Jover 61b2dbb8 2013-07-15T01:44:30 Fix dehumanize_number() to correctly detect overflows Do not allow numbers greated than INT64_MAX and smaller than INT64_MIN. Clarify the positive sign value by prefixing it with an explicit +. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66909
Guillem Jover 11941746 2013-07-14T10:58:20 Release libbsd 0.6.0
Guillem Jover 948bcf1d 2013-07-13T02:11:20 Warn when setproctitle() gets called before initialization Try to give a helpful message in case the program is not initializing the setproctitle() machinery.
Guillem Jover c5b95902 2013-07-11T12:25:54 Move setproctitle() automatic initialization to its own library The automatic initialization cannot be part of the main shared library, because there is no thread-safe way to change the environ global variable. This is not a problem if the initializaion happens just at program load time, but becomes one if the shared library is directly or indirectly dlopen()ed during the execution of the program, which could have either kept references to the old environ or could change it in some other thread. This has been observed for example on systems using Samba NSS modules. 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 linker flags will mark the program as not allowing to be dlopen()ed so that we avoid the problem described above. Reported-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66679
Guillem Jover 3077d2ff 2013-07-12T22:15:58 build: Move version ABI from Makefile to configure.ac It's easier to find there, and the value can be reused in case we have to provide another shared library.
Guillem Jover 1bf0a555 2013-06-08T17:43:42 Release libbsd 0.5.2
Guillem Jover ad613d9d 2013-06-07T07:11:50 Create a shallow copy of environ before replacing it in setproctitle() Because clearenv() or setenv() might free the environ array of pointers, we should make sure to copy it so that we can access it later on when doing the deep copy via setenv(). Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=65470
Guillem Jover e084ce3f 2013-06-07T04:46:29 Specify setproctitle_stub() signature manually if typeof is missing Do not stop exporting the function in the version node even if typeof is not available, as that would break ABI.
Guillem Jover 50e4c55a 2013-06-08T17:55:19 Try to check if setproctitle() constructor got passed arguments
Guillem Jover 6faea4d2 2013-05-29T02:23:56 Force setproctitle() into .init_array section The GNU .init_array support is an extension over the standard System V ABI .init_array support, which passes the main() arguments to the init function. This support comes in three parts. First the dynamic linker (from glibc) needs to support it. Then function pointers need to be placed in the section, for example by using __attribute__((constructor)), that the compiler (gcc or clang for example) might place in section .ctors and the linker (from binutils) will move to .init_array on the output object, or by placing them directly into .init_array by the compiler when compiling. If this does not happen and the function pointers end up in .ctors, then they will not get passed the main() arguments, which we do really need in this case. But this relies on recent binutils or gcc having native .init_array support, and not having it disabled through --disable-initfini-array. To guarantee we get the correct behaviour, let's just place the function pointer in the .init_array section directly, so we only require a recent enough glibc. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=65029
Guillem Jover 367e0365 2013-06-08T08:15:21 test: Try setting and getting an environment variable after setproctitle()
Guillem Jover dc8b0978 2013-05-30T04:09:25 build: Ignore automake 1.13+ test suite generated files
Guillem Jover 46633647 2013-05-27T06:52:05 Release libbsd 0.5.1
Guillem Jover df5aebd7 2013-05-27T06:49:57 test: Mark a literal integer as long long This fixes build failures on 32-bit architectures.
Guillem Jover 95878823 2013-05-21T04:34:34 Release libbsd 0.5.0