Commit Graph

632 Commits

Author SHA1 Message Date
Joachim Wiberg
883b351351 Allow loop initial declarations, explicitly enable C99
Fixes the following error on certain buildroot toolchains:

    syslogd.c: In function 'fmt5424':
    syslogd.c:1583:2: error: 'for' loop initial declarations are only allowed in C99 mode
      for (int j = 25; j >= 20; --j) {
           ^

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 12:50:51 +01:00
Joachim Wiberg
f735f54714 Adjust repology listing below logo, messes up new GitHub layout
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 23:11:06 +02:00
Joachim Wiberg
1882a1bdc1 Revert "Travis-CI: Disable clang for Coverity Scan run"
This reverts commit 88705a2e62.
2020-08-31 23:09:52 +02:00
Joachim Wiberg
88705a2e62 Travis-CI: Disable clang for Coverity Scan run
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 23:02:03 +02: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
a719f66bdd Start v2.2.0 dev cycle
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-31 21:28:45 +02:00
Joachim Wiberg
5aa7372f4c Fix #19: Prefer /dev/kmsg over /proc/kmsg on Linux
This patch migrates the sysklogd project to use the modern /dev/kmsg
interface on Linux.  There are many advantages over the older /proc
interface; 1) no need to wait for /proc to be mounted, 2) it provides
multiple simultaneous access.  For more information, see:

  https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg

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 Wiberg
91a51cffbe Merge branch 'sandy-lcq-master'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-08-27 08:10:15 +02:00
Changqing Li
e684939559 Makefile.am: fixup issue #17
only make $(LIBOBJS) depend on $(LTLIBOBJS) still have race condition,
library like pidfile.o may be changed when compile or link for target
libsyslog_la_LIBADD, which will cause problem like below:

ERROR: dwarfsrcfiles failed with exit code 1 (cmd was ['dwarfsrcfiles', /tmp/work/ppc7400-oe-linux/sysklogd/2.1.2-r0/package/usr/lib/libsyslog.a']):
dwarfsrcfiles: tmp/work/ppc7400-oe-linux/sysklogd/2.1.2-r0/package/usr/lib/libsyslog.a: not a valid ELF file

arm-oe-linux-gnueabi-libtool: link: arm-oe-linux-gnueabi-gcc  -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=TOPDIR/tmp-glibc/work/armv7vet2hf-neon-oe-linux-gnueabi/sysklogd/2.1.2-r0/recipe-sysroot -shared  -fPIC -DPIC  .libs/libsyslog_la-syslog.o ../lib/.libs/pidfile.o ../lib/.libs/strlcpy.o ../lib/.libs/strlcat.o    -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=TOPDIR/tmp-glibc/work/armv7vet2hf-neon-oe-linux-gnueabi/sysklogd/2.1.2-r0/recipe-sysroot -O2 -g -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed   -Wl,-soname -Wl,libsyslog.so.0 -o .libs/libsyslog.so.0.0.0
arm-oe-linux-gnueabi-libtool: link: (cd ".libs" && rm -f "libsyslog.so.0" && ln -s "libsyslog.so.0.0.0" "libsyslog.so.0")
arm-oe-linux-gnueabi-libtool: link: (cd ".libs" && rm -f "libsyslog.so" && ln -s "libsyslog.so.0.0.0" "libsyslog.so")
arm-oe-linux-gnueabi-libtool: link: arm-oe-linux-gnueabi-gcc-ar cru .libs/libsyslog.a  libsyslog_la-syslog.o ../lib/pidfile.o ../lib/strlcpy.o ../lib/strlcat.o
TOPDIR/tmp-glibc/work/armv7vet2hf-neon-oe-linux-gnueabi/sysklogd/2.1.2-r0/recipe-sysroot-native/usr/bin/arm-oe-linux-gnueabi/../../libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/10.1.0/ar: `u' modifier ignored since `D' is the default (see `U')
TOPDIR/tmp-glibc/work/armv7vet2hf-neon-oe-linux-gnueabi/sysklogd/2.1.2-r0/recipe-sysroot-native/usr/bin/arm-oe-linux-gnueabi/../../libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/10.1.0/ar: ../lib/strlcat.o: No such file or directory

Signed-off-by: Changqing Li <changqing.li@windriver.com>
2020-08-27 11:40:44 +08:00
Joachim Nilsson
52c5384817 Minor, adjust position
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-21 10:32:18 +02:00
Joachim Nilsson
121d6cbaee Minor, repology badge
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-21 10:31:22 +02:00
Joachim Nilsson
84115ed4a8
Create FUNDING.yml 2020-04-04 14:05:58 +02:00
Joachim Nilsson
6d6010add6 Update ChangeLog and bump version for v2.1.2 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-22 09:47:54 +01:00
Joachim Nilsson
5eec48df9d Minor, wording and formatting of comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-22 09:47:01 +01:00
Joachim Nilsson
4c9ede6e43
Merge pull request #18 from sandy-lcq/master
fix one rarely reproduced parallel build problem
2020-03-20 16:28:47 +01:00
Changqing Li
b88e21d177 fix one rarely reproduced parallel build problem
fix for this issue:
https://github.com/troglobit/sysklogd/issues/17

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Changqing Li <changqing.li@windriver.com>
2020-03-20 16:52:41 +08:00
Joachim Nilsson
b216a6a0bf Travis-CI: Move to Ubuntu 18.04 for building and testing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-12 19:18:15 +01:00
Joachim Nilsson
24dafe9a27 Update ChangeLog and bump version for v2.1.1 bug fix release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 21:21:57 +01:00
Joachim Nilsson
c20c748afa Workaround for weird automake buglet
The `make distcheckclean` command fails because of lingering .o files in
lib/.libs/ which it shouldn't, since both AC_CONFIG_LIBOBJ_DIR() and the
subdir-objects automake options are set.

This workaround is ugly, but works for now.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 21:21:57 +01:00
Joachim Nilsson
6da50d15f7 syslogd: Minor, reduce scope of local variables
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 19:59:37 +01:00
Joachim Nilsson
f35aa0760e syslogd: Minor, reduce code duplication
Found by clang-tidy

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 19:59:21 +01:00
Joachim Nilsson
d94163d721 Add unit test to check syslog.conf rule option parsing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 10:46:59 +01:00
Joachim Nilsson
d22f7168e0 Revert "syslogd: cfopts(): reinit strtok() so both OPT1,OPT2 are found"
This reverts commit d758581 since it breaks unit tests by missing the
first option after ;

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 10:30:25 +01:00
Steffen Nurpmeso
d75858100c syslogd: cfopts(): reinit strtok() so both OPT1,OPT2 are found
Signed-off-by: Steffen Nurpmeso <steffen@sdaoden.eu>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 09:32:30 +01:00
Joachim Nilsson
ee47b88cd2 Follow-up to 84d70e6, fix spelling
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 09:11:15 +01:00
Joachim Nilsson
64257d689d Minor, cleanup/coding-style
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 09:10:58 +01: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
de4c349930 Update ChangeLog for v2.1.1 bug fix release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-17 13:34:35 +01:00
Johan Askerin
5bfe15f767 syslogd: Fix startup issue with remote sinks
Only reset f_fime when the filed is in normal operation, not suspended,
otherwise the INET_SUSPEND_TIME handling is broken.

Signed-off-by: Johan Askerin <johan.askerin@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-17 13:20:52 +01:00
Joachim Nilsson
773e69ea2e syslogd: Ignore temporary network problems when sending remote
When sending to a remote syslog server, configured as an IP address or
when the DNS name has already been resolved, we may get temporary error
messages like ENETUNREACH and similar from sendmsg().

Before this patch the whole filed was placed in F_FORW_SUSP, like failed
DNS resolve, which introduces a 180 sec delay before even trying again.
A better approach is to just try again with the next syslog message.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-17 13:01:29 +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
43eee3d405 Update ChangeLog and bump version for v2.1 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-05 13:33:02 +01:00
Joachim Nilsson
f33acb2521 Travis-CI: Minor fixes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-05 13:33:02 +01:00
Joachim Nilsson
0af76f37ae Revert "Travis-CI: Disable clang temporarily for Coverity Scan run"
This reverts commit 100d90b452.
2020-01-05 13:33:02 +01:00
Joachim Nilsson
100d90b452 Travis-CI: Disable clang temporarily for Coverity Scan run
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-04 10:39:35 +01:00
Joachim Nilsson
e0411a3a56 Fix invalid format specifier for f_prevcount, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-03 09:51:48 +01:00
Joachim Nilsson
39ea566d45 Fix minor descriptor leak, found by Coverity Scan
It is safe to always close() the fd here.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-03 09:46:11 +01:00
Joachim Nilsson
f06ab73e13 Minor updates, spell checking, etc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-25 08:47:31 +01:00
Joachim Nilsson
38d0440975 Update ChangeLog with latest fixes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-25 08:25:48 +01:00
Joachim Nilsson
0f7ee8d430 syslogd: Fix variable names shadowing other global or local defs.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-16 22:06:26 +01:00
Joachim Nilsson
ff03287d5a syslogd: Use snprintf() rather than sprintf()
Protects against buffer overruns.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-16 22:06:26 +01:00
Joachim Nilsson
0afdfb4911 syslogd: Handle multiple invocations of SIGHUP
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-16 13:25:48 +01:00
Joachim Nilsson
0e7c76c3f5 .github: sudo do-what-I-mean
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-16 13:17:13 +01:00
Joachim Nilsson
753d6f0cda .github: Attempt number 1231245432432 to install packages in runner
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-16 11:21:37 +01:00
Joachim Nilsson
9c05d380f3
Use non-interactive install
Why isn't the runner configured to use this by default?
2019-12-16 11:18:01 +01:00
Joachim Nilsson
722a77857f
Split apt-get update and install in separate steps
Yaml isn't really suited to writing shell scripts :-/
2019-12-16 11:11:42 +01:00
Joachim Nilsson
ce4a3c1f0a
Run apt-get update first 2019-12-16 11:08:57 +01:00
Joachim Nilsson
55a12321c0
Accept any deps. to packages in runner install 2019-12-16 11:00:56 +01:00
Joachim Nilsson
4bbb813f1b
Install tshark in runner 2019-12-16 10:58:39 +01:00