101 Commits

Author SHA1 Message Date
Rainer Gerhards
b326c76f45 style: normalize C source formatting via clang-format (PoC)
This commit applies the new canonical formatting style using `clang-format` with custom settings (notably 4-space indentation), as part of our shift toward automated formatting normalization.

⚠️ No functional changes are included — only whitespace and layout modifications as produced by `clang-format`.

This change is part of the formatting modernization strategy discussed in:
https://github.com/rsyslog/rsyslog/issues/5747

Key context:
- Formatting is now treated as a disposable view, normalized via tooling.
- The `.clang-format` file defines the canonical style.
- A fixup script (`devtools/format-code.sh`) handles remaining edge cases.
- Formatting commits are added to `.git-blame-ignore-revs` to reduce noise.
- Developers remain free to format code however they prefer locally.
2025-07-16 13:56:21 +02:00
alakatos
2348c6424a Introduce --enable-libcap-ng configure option
The option allows to drop the capabilities to only
the necessary set, to minimize security exposure in
case there was ever a mistake in a networking
plugin or some other input resource. Moreover, it adds
ability to change uid and gid while retaining the
previously specified capabilities. Resolves #4986

Add ability to change uid and gid while retaining the capabilities previously specified
2022-11-14 09:59:50 +01:00
Michael Biebl
6569133c75
Typo fixes (#4801)
* typo fix: ambigious -> ambiguous

* typo fix: aquire -> acquire

* typo fix: assgined -> assigned

* typo fix: cancelation -> cancellation

* typo fix: childs -> children

* typo fix: configuraton -> configuration

* typo fix: delemiter -> delimiter

* typo fix: forwardig -> forwarding

* typo fix: initializiation -> initialization

* typo fix: intializing -> initializing

* typo fix: lengh -> length

* typo fix: mesage -> message

* typo fix: occured -> occurred

* typo fix: occurence -> occurrence

* typo fix: paramter -> parameter

* typo fix: remaing -> remaining

* typo fix: resetted -> reset

* typo fix: suppored -> supported

* typo fix: Sytem -> System

* typo fix: uncommited -> uncommitted

* typo fix: depricated -> deprecated

* typo fix: stoping -> stopping

* type fix: allow to -> allow one to
2022-02-17 10:54:12 +01:00
Josh Soref
bfd9248670 spelling: https 2018-11-14 11:56:57 -05:00
Rainer Gerhards
15d5bd794d
fix small issue detected by cppcheck 2018-11-07 10:14:35 +01:00
Rainer Gerhards
9bece39dc6
SQUASH
debug cleanup: remove some old, no longer used macros
2018-10-30 12:46:04 +01:00
Rainer Gerhards
9e89322b59
cleanup: remove no longer needed --enable-rtinst code
--enable-rtinst is gone-away since a while, but there were still
some supporting code left. It required careful anaylsis what could
actually be removed. This is now done and the code fully cleaned
up.

As a positive side effect, we could eliminate mutex calls inside
the debug system. This means we are more likely to reproduce race
conditions in runs with debugging enabled.

closes https://github.com/rsyslog/rsyslog/issues/2211
2018-10-30 12:25:00 +01:00
Rainer Gerhards
3b5ed2d046
cleanup: remove no longer needed code
see also https://github.com/rsyslog/rsyslog/issues/2211
2018-10-25 17:52:45 +02:00
PascalWithopf
c83e3ed216 correct codestyle in rsyslog part 2 2018-08-01 16:11:33 +02:00
PascalWithopf
19133327cc correct codestyle in rsyslog 2018-07-31 09:44:27 +02:00
Rainer Gerhards
7d52d7676b
"fix" gcc 8 false warnings
These warnings are definitely overdone, but the clutter the build log
so we change it. It's kind of sad, as code cleanness is actually
reduced, but it doesn't help. The core issue is that we can suppress
the warning itself, but but the extra information lines to go with it.
2018-07-19 12:53:19 +02:00
Rainer Gerhards
95468d009b
silence some static analyzer warnings (hopefully)
especially in the debug case there is simply no other chance
than to ignore the error...
2018-07-02 13:35:26 +02:00
Rainer Gerhards
7f1d33e090 testbench: improve queue timeout detection
and also fix that it was accidentely not activated in testbench runs
2018-05-10 17:19:54 +02:00
Rainer Gerhards
a3d4895b78 debug support: add capability to print testbench-specific timeout reports
done by setting RSYSLOG_DEBUG_TIMEOUTS_TO_STDERR to "on"

this is by default activated inside the testbench
2018-05-09 17:15:34 +02:00
Rainer Gerhards
48c397374d fix some __attribute__((unused)) and add missing ones
as it looks, some compiler versions (e.g. gcc 7) seem to be rather
picky on the position where this attribute is applied. So this
commit moves them to the position where they are properly detected.

We also add missing attributes. Some are missing due to conditional
compilation what we did not detect in our regular development
environments. This now comes up as we have enabled the corresponding
warning globally, and so they now also show up on those platforms.
2018-04-10 14:44:58 +02:00
PascalWithopf
29c9fb1f9a codestyle: reduce line length to 120
lines are still checked for a length of 125 because
these are just some of the lines
2017-12-21 17:09:32 +01:00
PascalWithopf
79de51e4fc codestyle: reduce max line length to 125 2017-12-20 16:16:57 +01:00
Rainer Gerhards
ab7677108e cleanup: remove unused runtime instrumentation code
The --enable-rtinst configure switch and associated instrumentation
code dates back to the time pre-(valgrind, address sanitizer, ...).
It has not been actively used by rsyslog developers for years and is
inferior to the new debugging tools.

With this commit, we remove the --enable-rtinst option and do some
mild refactoring of the code itself. As it turned out, fully removing
the debug code requires a bit more of time, and we push this as a
follow-on activity. It's not as urgent as getting us to build
properly under all configure switches.

closes https://github.com/rsyslog/rsyslog/issues/2048
2017-12-12 16:39:36 +01:00
PascalWithopf
e485c5c5bc codestyle: shorten lines to max 130 chars 2017-11-15 09:04:42 +01:00
Rainer Gerhards
167c57f17e build: remove #pragmas which can cause build issues 2017-11-04 15:28:41 +01:00
mrworkman
bb60c206f0 Fix broken 'debugless' build. 2017-09-12 08:01:39 -04:00
Jan Gerhards
edfc4396a3 core: add parameters debug.file and debug.whitelist
allows to generate debug log output only of specific files
2017-08-08 12:12:39 +02:00
Pascal Withopf
b63a6b9010 codestyle: line length adjusted 2017-01-17 08:54:37 +01:00
purnima
653434a4a5 Fix unintended changes in AIX Port 2016-11-22 16:51:07 +05:30
purnima
d45daa2af0 Rebase,redefine msgDestruct() as smsg_t is used 2016-11-22 14:24:25 +05:30
Rainer Gerhards
c403a56f09 remove inline from excessively long functions 2016-10-08 16:50:12 +02:00
Rainer Gerhards
bbcbb03c64 fix compiler warnings 2016-07-22 15:00:28 +02:00
Rainer Gerhards
b3940cb966 remove excessive "inline" attributes 2016-06-03 12:24:27 +02:00
Rainer Gerhards
8a8675b223 fix compiler warnings 2016-06-02 10:18:05 +02:00
Rainer Gerhards
887fcfac9e fix missing prototypes in config system 2016-06-01 10:32:29 +02:00
Rainer Gerhards
ee6b11f9ad cleanup: remove unused code 2016-04-25 08:09:18 +02:00
Peter Portante
2470f0f72b Remove use of sizeof(char) and sizeof(uchar)
Remove the use sizeof(char) or sizeof(uchar) in calculations for memory
allocation or string length.  There are no known platforms for which
sizeof(char) or sizeof(uchar) is not 1, and c99 has defined sizeof(char)
to be 1 (section 6.5.3.4 of c99).
2015-12-16 02:18:45 +00:00
Rainer Gerhards
5158095113 Merge branch 'v8-stable' 2014-07-22 16:21:49 +02:00
Tomas Heinrich
85ba90da09 Prevent dereferencing a NULL pointer
Error: NULL_RETURNS (CWE-476):
rsyslog-7.4.10/runtime/debug.c:698: returned_null: Function "calloc(size_t, size_t)" returns null (checked 107 out of 123 times).
rsyslog-7.4.10/action.c:333: example_checked: Example 1: "calloc(1UL, 264UL)" has its value checked in "(pThis = (action_t *)calloc(1UL, 264UL)) == NULL".
rsyslog-7.4.10/grammar/rainerscript.c:932: example_checked: Example 2: "calloc(params->nParams, 24UL)" has its value checked in "(vals = calloc(params->nParams, 24UL)) == NULL".
rsyslog-7.4.10/outchannel.c:47: example_checked: Example 3: "calloc(1UL, 48UL)" has its value checked in "(pOch = calloc(1UL, 48UL)) == NULL".
rsyslog-7.4.10/parse.c:75: example_checked: Example 4: "calloc(1UL, 16UL)" has its value checked in "(pThis = (rsParsObj *)calloc(1UL, 16UL)) == NULL".
rsyslog-7.4.10/plugins/imfile/imfile.c:496: example_checked: Example 5: "calloc(1UL, 40UL)" has its value checked in "(pModConf = calloc(1UL, 40UL)) == NULL".
rsyslog-7.4.10/runtime/debug.c:698: var_assigned: Assigning: "pThrd" = null return value from "calloc(size_t, size_t)".
rsyslog-7.4.10/runtime/debug.c:699: dereference: Dereferencing a null pointer "pThrd".
2014-07-22 16:13:42 +02:00
Rainer Gerhards
0072f3c50c comment correction 2014-07-16 09:13:30 +02:00
Rainer Gerhards
36ef9e7e11 re-enable thread naming in debug logs 2014-07-16 08:04:16 +02:00
Rainer Gerhards
12ee4a7610 add messages when using new debug system
Conflicts:

	configure.ac
2013-12-12 14:38:28 +01:00
Rainer Gerhards
80be25a5e0 add debug.OnShutdown global parameter 2013-12-11 14:51:53 +01:00
Rainer Gerhards
1f2b6f1a9b bugfix: potential hang *in debug mode* on rsyslogd termination 2013-05-15 07:45:33 +02:00
Rainer Gerhards
aef0be0c17 bugfix: solve compile problems on non-Linux platforms
Thanks to Michael Biebl for alerting us on this issue.
2013-03-19 16:20:25 +01:00
Rainer Gerhards
dac7e3d39b Merge branch 'v7-stable'
Conflicts:
	runtime/debug.h
	tools/syslogd.c
2013-03-18 12:31:20 +01:00
Rainer Gerhards
0114b531b3 debug system improvement & bug fix for init system status (see below)
- rsyslogd startup information is now properly conveyed back to init
  when privileges are beging dropped
  Actually, we have moved termination of the parent in front of the
  priv drop. So it shall work now in all cases. See code comments in
  commit for more details.
- If forking, the parent now waits for a maximum of 60 seconds for
  termination by the child
- improved debugging support in forked (auto-backgrounding) mode
  The rsyslog debug log file is now continued to be written across the
  fork.
2013-03-15 14:33:23 +01:00
Rainer Gerhards
8700672c76 added ability to configure debug system via rsyslog.conf 2013-02-27 17:37:56 +01:00
Rainer Gerhards
17d48fc499 added capability to output thread-id-to-function debug info
This is a useful debug aid, but nothing of concern for regular users.
2013-01-13 12:14:58 +01:00
Rainer Gerhards
f161dfefd2 silence some primarily cosmetic compiler warning messages 2012-11-28 10:11:14 +01:00
Rainer Gerhards
d752786d4f re-enabled commented-out serialization support in debug handler 2012-10-11 09:27:30 +02:00
Rainer Gerhards
6bc629021e Merge branch 'v5-beta' into beta
Conflicts:
	ChangeLog
2012-05-29 11:36:13 +02:00
Tomas Heinrich
a4980cbde2 bugfix: if debug message could end up in log file when forking
if rsyslog was set to auto-background (thus fork, the default) and debug
mode to stdout was enabled, debug messages ended up in the first log file
opened. Currently, stdout logging is completely disabled in forking mode
(but writing to the debug log file is still possible). This is a change
in behaviour, which is under review. If it causes problems to you,
please let us know.

Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
2012-05-29 11:21:50 +02:00
Rainer Gerhards
ac9afc4149 Merge branch 'v5-stable' into master
Conflicts:
	ChangeLog
	action.h
	configure.ac
	doc/manual.html
	plugins/immark/immark.c
	plugins/impstats/impstats.c
	plugins/imptcp/imptcp.c
	plugins/imtcp/imtcp.c
	runtime/cfsysline.c
	runtime/cfsysline.h
	runtime/conf.c
	runtime/ctok.c
	runtime/ctok.h
	runtime/ctok_token.c
	runtime/ctok_token.h
	runtime/dnscache.h
	runtime/expr.c
	runtime/expr.h
	runtime/rule.c
	runtime/rule.h
	runtime/ruleset.h
	runtime/sysvar.c
	runtime/vm.h
	runtime/vmop.c
	runtime/vmop.h
	runtime/vmprg.c
	runtime/vmprg.h
	runtime/vmstk.c
	runtime/vmstk.h
	tools/omusrmsg.c
2012-01-18 14:08:24 +01:00
Rainer Gerhards
18e60f46a1 Merge branch 'v4-stable' into v5-stable
Conflicts:
	runtime/debug.h
	runtime/obj.c
	runtime/parser.h
	runtime/wti.h
2012-01-16 16:14:30 +01:00