Commit Graph

392 Commits

Author SHA1 Message Date
Guillem Jover
ab5db68bae build: Add missing \ at end of line
Fixes: commit 934b7a0ccb
2017-06-19 03:03:23 +02:00
Guillem Jover
5a46e4867d Update TODO 2017-06-18 23:37:01 +02:00
Guillem Jover
7a75f550e8 Update TODO 2017-06-09 05:47:07 +02:00
Guillem Jover
f1dd5f2e71 test: Add unit test for strlcpy() and strlcat() 2017-06-09 05:47:07 +02:00
Guillem Jover
c8a1b08b74 build: Match any glibc and musl ABIs on the host_os AS_CASE
Reported-by: Helmut Grohne <helmut@subdivi.de>
2017-06-09 05:47:07 +02:00
Guillem Jover
4fec871c79 build: Quote the arguments to AC_CONDITIONAL 2017-06-09 05:47:07 +02:00
Guillem Jover
3945693ebe build: Move AC_TYPE_UID_T close to the other AC_TYPE_* checks 2017-06-09 05:47:07 +02:00
Guillem Jover
c253365d65 build: Move configure.ac comment into actual AC_CASE 2017-06-09 05:47:06 +02:00
Guillem Jover
8248e5f7a6 build: Use src/strlcpy.c in AC_CONFIG_SRCDIR
The src/fgetln.c file contains a function considered obsolete, use one
that is not.
2017-06-09 05:46:34 +02:00
Guillem Jover
c74ca09916 man: Use .In intead of .Fd macros for includes 2017-06-09 05:46:34 +02:00
Guillem Jover
ba9e2a5a9c man: Add new libbsd(7) library overview man page 2017-06-09 05:46:29 +02:00
Guillem Jover
6a5a515820 man: Add missing man pages
This adds man pages for byteorder(3), errc(3) and fpurge(3), including
all their aliases.
2017-06-09 05:40:28 +02:00
Guillem Jover
934b7a0ccb man: Add missing aliases 2017-06-07 05:07:55 +02:00
Guillem Jover
f20e6972b3 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.
2017-06-06 04:37:56 +02:00
Guillem Jover
07c76b666d 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
2017-06-05 06:18:27 +02:00
Guillem Jover
e4475738fe Try <linux/a.out.h> if <a.out.h> is not present
At least musl ships the former but not the latter.
2017-06-05 05:52:07 +02:00
Guillem Jover
d6c35f618c Do not provide funopen() on musl
Fixes: https://bugs.debian.org/818246
2017-06-05 05:52:07 +02:00
Guillem Jover
db7470b048 Gracefully handle lack of system <sys/cdefs.h>
This is the case on musl.

Fixes: https://bugs.debian.org/810589
2017-06-05 05:52:07 +02:00
Guillem Jover
368af99f55 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.
2017-06-05 05:52:07 +02:00
Guillem Jover
337e620275 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>
2017-06-05 05:51:52 +02:00
Guillem Jover
088f147ec8 Add support for RISC-V 2017-06-05 05:31:35 +02:00
Helmut Grohne
b2b1020d8e Add support for TileGX
Fixes: https://bugs.debian.org/847560
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2017-01-16 09:59:20 +01:00
Guillem Jover
9bed430ee3 Release libbsd 0.8.3 2016-04-23 10:13:23 +02:00
Szabolcs Nagy
cbfe0ebca9 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>
2016-03-27 12:42:34 +02:00
Guillem Jover
f3b566bd7c test: Add a unit test for md5 2016-03-27 12:31:58 +02:00
Guillem Jover
e86c1b5f43 man: Fix ungrammatical construct
Warned-by: lintian
2016-02-14 09:01:24 +01:00
Guillem Jover
b7ce33cf51 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>
2016-02-13 08:46:47 +01:00
Guillem Jover
ed84bec5aa Switch URLs from http or git to https 2016-02-13 08:46:35 +01:00
Guillem Jover
cbe3057703 Fix file descriptor leak in HASHFileChunk helper
This leak only happens on error conditions, so it's not too bad.

Warned-by: coverity
2016-02-07 09:17:08 +01:00
Guillem Jover
5a32ea0a72 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
2016-02-07 09:16:47 +01:00
Guillem Jover
2fb148a290 Release libbsd 0.8.2 2016-01-27 15:25:23 +01:00
Hanno Boeck
c8f0723d2b 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>
2016-01-27 15:24:50 +01:00
Hanno Boeck
008316aa29 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>
2016-01-27 15:24:39 +01:00
Guillem Jover
e4ab2c62cd test: Fix success return code for arc4random unit test 2016-01-11 02:35:34 +01:00
Lukas Fleischer
bf5573f86c 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>
2016-01-10 17:36:34 +01:00
Guillem Jover
229f85794f Release libbsd 0.8.1 2015-12-14 03:39:48 +01:00
Guillem Jover
7a75687541 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.
2015-12-14 03:38:23 +01:00
Guillem Jover
f84004baf2 test: Add new unit tests for individual headers usage 2015-12-14 03:34:40 +01:00
Guillem Jover
cdf998a056 Turn <bsd/bsd.h> inert when using LIBBSD_OVERLAY
Also print a warning stating this fact.
2015-12-14 00:58:59 +01:00
Guillem Jover
2c77ad593c Add missing include to <md5.h>
The header was not self-contained, it was missing definitions for some
types included in <sys/types.h>.
2015-12-14 00:58:59 +01:00
Guillem Jover
48ac79b188 Use the non-overlayed libbsd headers when we need our own definitions 2015-12-14 00:58:51 +01:00
Guillem Jover
290a1ce8f2 Switch COPYING to Debian copyright machine readable format 1.0 2015-12-07 03:36:33 +01:00
Guillem Jover
6bcb1312f4 Relicense my contribution to BSD-2-clause
This avoids having two licenses on the same file.
2015-12-07 03:24:47 +01:00
Guillem Jover
da137a0921 Add missing copyright and license headers 2015-12-07 01:56:25 +01:00
Guillem Jover
d2f59a23d5 Fix getentropy implementation to use the correct system hooks
Include getentropy_<SYSTEM>.c instead of arc4random_<SYSTEM>.c.
2015-12-02 04:03:16 +01:00
Guillem Jover
01b77f0dcf Add support for GNU/kFreeBSD for closefrom() and getentropy() 2015-12-02 03:32:13 +01:00
Guillem Jover
75729394af 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.
2015-12-02 03:08:17 +01:00
Guillem Jover
8493c7f27d 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.
2015-12-01 03:40:57 +01:00
Guillem Jover
2b030da016 Release libbsd 0.8.0 2015-11-30 23:48:50 +01:00
Guillem Jover
330e211142 Update license and copyright information 2015-11-30 23:48:50 +01:00