Commit Graph

709 Commits

Author SHA1 Message Date
Guillem Jover
a4dd754c8d man: Ship and install libbsd(7)
Fixes: https://bugs.freedesktop.org/101543
2017-06-24 16:08:27 +02:00
James Cowgill
b480b7a3f8 Fix ELF definitions for MIPS in local-elf.h
Add a check for _MIPS_SIM inside the __mips__ #elif to detect mips64el
and use ELFCLASS64 in that case. Note that we can't use defined(__mips64)
here because that is also defined when the n32 ABI is in use, which uses
ELFCLASS32.

Fixes: https://bugs.debian.org/865091
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2017-06-24 16:08:22 +02:00
James Cowgill
4cc20e23f5 Fix ELF definitions for PowerPC in local-elf.h
* ppc64el defines both __powerpc__ and __powerpc64__ but since the
  __powerpc64__ #elif is below the __powerpc__ one, it will never be hit.
* Both assumed that powerpc* was big-endian.

Fixes: https://bugs.debian.org/865091
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2017-06-24 16:08:14 +02:00
Guillem Jover
c4e58c0950 test: Remove unused variable in nlist() unit test 2017-06-24 16:06:15 +02:00
Guillem Jover
736e12e8d8 test: Handle libtool executable names in getprogname() unit test
Sometimes libtool will prefix the test programs with "lt-", we should
handle these and strip the prefix.

Fixes: https://bugs.debian.org/865090
2017-06-24 16:05:50 +02:00
Guillem Jover
8bff4b1fab Release libbsd 0.8.4 2017-06-19 03:17:21 +02:00
Guillem Jover
0071b97958 Import <sys/time.h> for some of its macros
Fixes: https://bugs.freedesktop.org/94320
2017-06-19 03:17:21 +02:00
Guillem Jover
cdbb9d0555 test: Add new strnstr() unit test 2017-06-19 03:17:21 +02:00
Guillem Jover
0365d0efda test: Add new setprogname() and getprogname() unit test 2017-06-19 03:17:21 +02:00
Guillem Jover
10b1328570 test: Add new setmode() and getmode() unit test 2017-06-19 03:17:21 +02:00
Guillem Jover
922eff5c5e test: Add new nlist() unit test 2017-06-19 03:17:21 +02:00
Guillem Jover
8e8834d8e5 Remove RCSID tags
These are obsolete markers, and in some cases they repeat the
information already present in the comment header.
2017-06-19 03:17:21 +02:00
Guillem Jover
7938619254 Update .gitignore for headers generator 2017-06-19 03:17:21 +02:00
Guillem Jover
ec5d9a685a Namespace header inclusion protection macros
Use LIBBSD_, and remove trailing underscores.
2017-06-19 03:17:21 +02:00
Guillem Jover
47013bc92a Fix broken mmap() usage in nlist() by switching to pread()
The offset is not page aligned, which makes mmap() return EINVAL on
Linux. Switch to use pread() which handles unaligned offset and non-page
sized reads, and because we are already loading parts of the executable
by read() calls, so there's not much point in using mmap() anyway.
2017-06-19 03:17:21 +02:00
Guillem Jover
e8d340de9e Remove a.out support from nlist()
Some libc libraries do not have an <a.out.h> header. And a.out as an
executable format is very much obsolete on pretty much all currently
supported systems, even if they might still support loading such
objects.

Remove the a.out support to increase portability.
2017-06-19 03:17:21 +02:00
Igor Gnatenko
7aede6a999 Make strlcpy()/strlcat() slightly easier to read
Backport new changes from OpenBSD.

[guillem@hadrons.org:
 - Update copyright years in COPYING. ]

References: https://svnweb.freebsd.org/base?view=revision&revision=281135
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2017-06-19 03:17:21 +02:00
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