|
6f68c930
|
2018-05-21T00:22:38
|
|
Switch strtonum() implementation from strtoll() to strtoi()
Import from NetBSD.
|
|
e13b1a33
|
2018-05-21T00:20:49
|
|
Import strtoi() and strtou() functions from NetBSD
|
|
2d7de186
|
2018-05-21T03:09:05
|
|
Update vis/unvis modules from NetBSD
|
|
e3979d1a
|
2018-05-20T19:22:16
|
|
Update humanize_number() from FreeBSD
Implements HN_IEC_PREFIXES.
|
|
facbddb6
|
2018-05-20T19:18:18
|
|
Update pidfile module from FreeBSD
Use EINVAL instead of EDOOFUS. Add a missing synopsis for
pidfile_fileno() in the man page. Move the definition of struct pidfh
from libutil.h into pidfile.c following upstream change.
|
|
3efad641
|
2018-05-21T01:56:33
|
|
Update readpassphrase() from OpenBSD
|
|
3d88c999
|
2018-05-15T00:41:26
|
|
Update arc4random() headers from OpenBSD
Split Linux support into its own header separate from the generic Unix
to fix a Linux-specific issue with clone(). Reset rsp to NULL on failure.
|
|
e42381dc
|
2018-05-15T00:41:26
|
|
Update getentropy() code from OpenBSD
Includes changes to handle the Linux syscall blocking when there is not
enough entropy during boot, by switching it to non-blocking mode and
falling back to the alternative implementations. Man page URL reference
fixes. Build fixes for Mac OS X.
Fixes: https://bugs.debian.org/898088
|
|
ef5faeb5
|
2018-05-20T19:20:33
|
|
Update few RCS keyword contents to match BSD originals
This will slightly reduce the delta, and makes it easier to compare the
sources.
|
|
a6f407ab
|
2018-05-21T01:34:17
|
|
Update heapsort() from OpenBSD
|
|
21edbb4f
|
2018-05-21T00:31:15
|
|
Update fmtcheck() from NetBSD
|
|
993828d8
|
2018-05-21T01:11:46
|
|
Add flopenat() function from FreeBSD
|
|
f6ed7c27
|
2018-04-03T20:10:14
|
|
Fix build for openrisc with uClibc
uClibc defines EM_OR1K instead of EM_OPENRISC for the OpenRISC ELF
e_machine ID. Use EM_OR1K when EM_OPENRISC is not defined.
This fixes the following build failure:
In file included from nlist.c:44:0:
nlist.c: In function ‘__elf_is_okay__’:
local-elf.h:224:23: error: ‘EM_OPENRISC’ undeclared (first use in this function)
#define ELF_TARG_MACH EM_OPENRISC
^
nlist.c:77:26: note: in expansion of macro ‘ELF_TARG_MACH’
if (ehdr->e_machine == ELF_TARG_MACH &&
^
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
5ba8c5ba
|
2018-03-05T00:37:47
|
|
progname: Port to Windows
Define the directory separator depending on the system targetted.
Reported-by: Progyan Bhattacharya <progyanb@acm.org>
|
|
0093ca2b
|
2018-03-05T00:02:34
|
|
Handle SPARC V8+ on Sun Studio compiler
|
|
0b65d439
|
2018-03-04T23:44:52
|
|
Add support for ELF machine EM_SPARC32PLUS
32-bit SPARC on V8+ uses a different ELF machine type.
Fixes: https://bugs.gentoo.org/634550
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
2a8514d8
|
2017-07-17T00:57:07
|
|
Fix handling of non-contiguous argv + envp in setproctitle()
The two arrays might not reference contiguous memory, and assuming they
are does break at least now on GNU/Hurd, which contains an unmapped
memory block between the memory used by the two arrays.
Just check that each element is strictly after the previous one, so that
we know there are no unmapped memory blocks inbetween.
|
|
b480b7a3
|
2017-06-19T21:38:40
|
|
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>
|
|
4cc20e23
|
2017-06-19T21:37:14
|
|
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>
|
|
8e8834d8
|
2017-06-14T02:53:35
|
|
Remove RCSID tags
These are obsolete markers, and in some cases they repeat the
information already present in the comment header.
|
|
47013bc9
|
2017-06-14T01:49:25
|
|
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.
|
|
e8d340de
|
2017-06-05T05:30:27
|
|
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.
|
|
7aede6a9
|
2016-06-27T09:21:43
|
|
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>
|
|
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
|
|
d6c35f61
|
2017-01-10T04:33:15
|
|
Do not provide funopen() on musl
Fixes: https://bugs.debian.org/818246
|
|
088f147e
|
2017-02-08T01:49:48
|
|
Add support for RISC-V
|
|
b2b1020d
|
2017-01-10T03:47:52
|
|
Add support for TileGX
Fixes: https://bugs.debian.org/847560
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
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>
|
|
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>
|
|
ed84bec5
|
2016-02-10T10:38:51
|
|
Switch URLs from http or git to https
|
|
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
|
|
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
|
|
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>
|
|
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.
|
|
da137a09
|
2015-12-07T01:53:49
|
|
Add missing copyright and license headers
|
|
d2f59a23
|
2015-12-02T04:00:58
|
|
Fix getentropy implementation to use the correct system hooks
Include getentropy_<SYSTEM>.c instead of arc4random_<SYSTEM>.c.
|
|
01b77f0d
|
2015-12-02T03:32:13
|
|
Add support for GNU/kFreeBSD for closefrom() and getentropy()
|
|
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.
|
|
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.
|
|
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
|
|
9a9a8b2d
|
2015-09-23T19:39:47
|
|
Add private getentropy module from OpenBSD and LibreSSL
Adapt the code to the local build system.
|
|
5f9265f8
|
2015-09-23T20:13:33
|
|
Add private SHA512 module from FreeBSD
|
|
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>
|
|
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.
|
|
45443583
|
2015-09-23T19:37:37
|
|
Add explicit_bzero() function from OpenBSD
|
|
8641d8ae
|
2015-09-24T04:01:11
|
|
Make closefrom_procfs() fail when reallocarray() fails
|
|
cfb4d462
|
2014-11-01T00:54:09
|
|
test: Move and activate fpurge() test case from module to a dedicated file
|
|
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.
|
|
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.
|
|
41ff37bb
|
2015-09-22T16:21:12
|
|
build: Add support for linker warnings
|
|
53d989a2
|
2014-12-13T21:28:36
|
|
Switch fparseln() implementation from fgetln() to getline()
|
|
f50b197e
|
2015-09-22T22:30:17
|
|
test: Add fparseln() unit test
|
|
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>
|
|
025b4480
|
2014-11-04T05:34:46
|
|
Make mergesort setup() static
|
|
a6a101ef
|
2014-11-04T05:33:26
|
|
Use ANSI C prototypes
|
|
32388fe5
|
2014-11-03T23:21:52
|
|
Use reallocarray() instead of malloc() or realloc()
|
|
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
|
|
4cc43915
|
2014-11-02T23:58:23
|
|
Move procfs based implementation into a new closefrom_procfs() function
|
|
34df1426
|
2014-11-05T20:01:53
|
|
Refactor file descriptor closure into a new closefrom_close()
|
|
3881c4fc
|
2014-11-02T00:23:00
|
|
Update closefrom() function
Import from sudo. Adapt the build system to detect the required features.
|
|
02b55488
|
2014-08-12T12:32:34
|
|
Use stdint integer types instead of BSD legacy ones
|
|
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.
|
|
faa005cb
|
2014-06-27T02:05:11
|
|
Add reallocarray() function from OpenBSD
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
36aca8c0
|
2014-06-26T21:43:55
|
|
Add stringlist module from NetBSD
|
|
e8f93003
|
2014-06-26T21:32:11
|
|
Add getbsize() function
Import code from DragonFlyBSD and man page from FreeBSD.
|
|
a88bb838
|
2014-03-06T22:10:36
|
|
Add OpenRISC support to nlist()
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
8d16c3df
|
2013-10-11T05:43:42
|
|
Add timeconv module from FreeBSD
Inline license information from FreeBSD root dir COPYRIGHT file.
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
1bf0a555
|
2013-06-08T17:43:42
|
|
Release libbsd 0.5.2
|
|
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
|
|
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.
|
|
50e4c55a
|
2013-06-08T17:55:19
|
|
Try to check if setproctitle() constructor got passed arguments
|
|
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
|
|
46633647
|
2013-05-27T06:52:05
|
|
Release libbsd 0.5.1
|
|
95878823
|
2013-05-21T04:34:34
|
|
Release libbsd 0.5.0
|
|
509841b5
|
2013-05-25T15:44:57
|
|
build: Use AM_V_at for mkdir
|
|
7c4caa67
|
2013-05-25T15:36:11
|
|
Fix comparison between signed and unsigned integer compiler warnings
|
|
30349f89
|
2013-05-25T15:35:39
|
|
Update radixsort module from NetBSD
Merge some interesting changes.
|
|
96a2dae3
|
2013-05-25T15:31:45
|
|
Update setmode module from NetBSD
Merge some interesting changes.
|
|
a4812cdf
|
2013-03-15T01:13:58
|
|
Fix getpeereid() compilation on Solaris
The code in getpeereid() is unlikely to compile as ucred_t is an opaque
struct (ucred_t * works but ucred_t does not). Either you need to give
a pointer initialized to NULL and getpeerucred() allocates a new ucred
or you call it with an allocated ucred as in this patch.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
d3a09e1c
|
2012-12-27T11:19:20
|
|
Switch dehumanize_number() to use expand_number()
The function is a duplicate of expand_number(), but covering less
prefixes and with a slightly different function signature.
Spotted-by: Peter da Silva <resuna@gmail.com>
|
|
e9933255
|
2013-05-25T17:11:53
|
|
Make setproctitle() available in 0.2 and 0.5 version nodes
Make the 0.5 version the default, so that code wanting the actual
implemented version can get a proper versioned depdendency. For code
linked against the old version, make it available as an alias.
|
|
c984dacd
|
2012-11-27T14:24:13
|
|
Implement sendmail semantics for setproctitle()
Prefix the title with "progname: ", and skip it if the format string
starts with '-' (which gets skipped on output too).
|
|
35785f8d
|
2012-11-25T21:10:53
|
|
Modify setproctitle() to conform to project coding style
Use local getprogname()/setprogname() instead of reimplementing them
locally. Use clearenv() if available, not just on glibc. Use bool
instead of _Bool. Use paranthesis on sizeof. Fold the SPT_MIN macro
into spt_min(). Make spt_init() static. Avoid unnecessary gotos.
|
|
2a0260d0
|
2012-11-28T11:09:02
|
|
Add a setproctitle() implementation
Taken from libnostd.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
f8d52ead
|
2012-11-23T18:33:23
|
|
Add x32 support to nlist()
|
|
cf683a27
|
2012-11-23T18:32:35
|
|
Add arm64 (aka aarch64) to nlist()
|
|
a97ce513
|
2012-11-23T21:19:45
|
|
Add new fgetwln() function
Man page taken from FreeBSD.
|
|
ee0489eb
|
2012-08-07T08:44:30
|
|
Add new fparseln() function
Taken from NetBSD.
[guillem@hadrons.org:
- Import from NetBSD instead of FreeBSD to get a 3-clause BSD license,
instead of a 4-clause one.
- Define compatibility macros.
- Change library from libc to libbsd and header in man page.
- Add copyright information to COPYING.
- Add symbol to map file. ]
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
cb7bc0d8
|
2012-11-25T22:09:43
|
|
Add file buffer pool support to fgetln()
This avoids buffer overwrites during concurrent or intermixed calls to
fgetln() when using more than one different stream (currently 32), which
the original interface supports natively by using an internal buffer
from the FILE structure. Although this workaround is rudimentary, it
should cover most of the theoretically problematic cases.
|
|
1be0bdb2
|
2012-11-25T21:13:38
|
|
Add new strnstr() function
Taken from FreeBSD.
|
|
ff0d700d
|
2012-11-23T17:16:43
|
|
Add new wcslcat() and wcslcpy() functions
Taken from FreeBSD.
|
|
918a4dba
|
2012-06-27T09:15:15
|
|
Release libbsd 0.4.2
|
|
14524b54
|
2012-06-03T07:39:42
|
|
build: Set default compiler variables from configure
This centralizes the setting so there's no duplication anymore,
makes sure the user supplied variables are never overridden, and
are only set when using gcc.
Reported-by: Samuli Suominen <ssuominen@gentoo.org>
|
|
c21d788f
|
2012-06-01T08:20:37
|
|
Release libbsd 0.4.1
|
|
fdcae577
|
2012-06-01T08:17:42
|
|
build: Set runtimelibdir to libdir
This makes sure the install-exec-hook under src works as expected even
when no runtimelibdir was specified, otherwise the symlinks end up
pointing to non-existing targets.
Reported-by: Ryan Mullen <rmmullen@gmail.com>
|