Commit Graph

12 Commits

Author SHA1 Message Date
Joachim Wiberg f926039511 Update copyright years
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-30 20:06:33 +02:00
Joachim Wiberg ae15ee11a7 lib: minor, ensure we have TIMESPEC_TO_TIMEVAL()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-30 20:02:51 +02:00
Joachim Wiberg 45085709e8 Update copyright years
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 11:16:04 +01:00
Joachim Wiberg 30842595d5 Update copyright years and author last name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 21:28:45 +02:00
Joachim Wiberg 93117e5801 Define _GNU_SOURCE, required for O_CLOEXEC on uClibc
When building sysklogd on a uClibc system we must define _GNU_SOURCE to
get O_CLOEXEC.

Since _GNU_SOURCE is also required for asprintf() with GLIBC, as used by
the pidfile() replacement function, we drop it from there and rely on
AM_CPPFLAGS for all sources.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-30 11:43:53 +02:00
Joachim Nilsson 5fce3001ed Simplify handling of replacement functions; strlcpy() & C:o
- Drop weak bindings, use simple #define in compat.h instead
- No need to #ifdef sources with HAVE_foo, configure handles this for us
- Move utimensat() declaration to compat.h from pidfile.c to be consistent

With these changes we can let libsyslog link with the replacement objs,
just like syslogd and logger does.  Because even if the C-library does
*not* have strlcpy() & C:o *and* an application has a local copy of any
of these APIs, our versions are prefixed with __ in the symbol table.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 09:08:48 +01:00
Joachim Nilsson 84d70e63fc Drop libcompat to simplify build deps and really fix #11
The original idea with libcompat was to keep as few objects as
possible for linking with libsyslog.  That in turn to prevent
a user of libsyslog from suddenly also getting strong binding
to symbols like strlcpy() from libsyslog, rather than their C
library of choice.

However, this caused strlcpy.c to be built as both .o and .lo
files, which in turn caused really bizarre build problems due
to bad DAG dependency.

This patch drops libcompat and instead marks all replacement APIs
as weak symbols, which a C library can override.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-16 22:17:23 +01:00
Joachim Nilsson 7793fcbd14 Fix #3: Don't guess PID file location, use configure --runstatedir
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-24 18:52:31 +01:00
Joachim Nilsson 58da3b6bd2 Mark strlcat() and strlcpy() as weak functions, for libsyslog
The strlcat() and strlcpy() functions are only intended to be used
by syslog.c internally (and syslogd), when building libsyslog.

A user linking with libsyslog may have another library that provides
strlcat() or strlcpy() replacements.  We must therefore mark ours as
weak functions so they can be overridden.

This patch also add a convenience library for libsyslog, to control
the build deps. for libsyslog.  This is where external dependencies
should be addded (explicitly) when syslog.c is updated from NetBSD.
If you add new deps you likely want to mark them too as weak refs.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 11:04:13 +01:00
Joachim Nilsson c05956010c Make sure libsyslog.la, incl. strlcpy.o, is built with -fPIC
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 15:55:25 +01:00
Joachim Nilsson ff4f2cdb31 Replace homegrown PID file functions with std BSD pidfile()
- Import pidfile() v1.11 from OpenBSD and libite (-lite) project
- Import utimensat() replacement, for systems that don't have it
- Simplify syslogd and klogd program start and PID file creation
- Rip out -i and -I from klogd, uses old PID file functions, and
  they're only kill(1) wrappers anyway

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-02 21:03:28 +01:00
Joachim Nilsson d83f781dc0 Add OpenBSD strlcat() and strlcpy() safe string manipulation APIs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-10-25 14:29:15 +02:00