Commit Graph

3529 Commits

Author SHA1 Message Date
NRK
bbd3acfc67 rc: avoid calling free inside SIGCHLD handler
`free` is not async-signal-safe and calling it inside a signal handler
can have bad effects, as reported in the musl ML:
https://www.openwall.com/lists/musl/2023/01/23/1

the solution:

- keep track of weather remove_pid() is being called from inside a
  signal handler or not.
- if it's inside a signal handler then DO NOT call free - instead put
  that pointer into a "to be freed later" list.
- if it's not inside a signal handler then take the "to be freed later"
  list and free anything in it.

Bug: https://github.com/OpenRC/openrc/issues/589
Reported-by: Dominique MARTINET <dominique.martinet@atmark-techno.com>
2023-04-24 19:20:19 -05:00
NRK
910e3e2a0e fstabinfo: deal with EINTR in waitpid call 2023-04-24 19:18:18 -05:00
NRK
5f04dcc951 fstabinfo: replace vfork with posix_spawnp
problem:
* vfork has been removed from POSIX [0].
* clang-tidy flags the `strerror` and `eerror` call inside the vfork-ed
  child as undefined behavior.

solution: use posix_spawnp, which is serves similar purpose and is
specified in posix. and as an added bonus, it's also easier to use and
less lines of code.

[0]: https://www.man7.org/linux/man-pages/man2/vfork.2.html#CONFORMING_TO
2023-04-24 19:18:18 -05:00
Oskari Pirhonen
8f52c64c37 einfo.h: fix EINFO_RESTRICT macro usage
Make function declarations use the EINFO_RESTRICT macro instead of
__EINFO_RESTRICT which gets treated as the name of the argument.
2023-04-23 16:11:15 -04:00
Sam James
09d405fb3e shared: fix pointer type in UNCONST
Thanks to vapier for noticing.
2023-04-20 07:50:49 -04:00
Sam James
36e4e04ba9 meson.build: add -Werror=... for modern C issues
Clang 16 makes these warnings fatal and GCC 14 is likely to as well.
2023-04-19 16:44:51 -04:00
Sam James
eb8831a141 Rename attribute macros to namespaced RC_*
This conflicts with linux-headers which uses __unused for some padding members
on ppc64le at least.

Closes: https://github.com/OpenRC/openrc/issues/622
2023-04-19 16:44:51 -04:00
William Hubbs
0b5cb3abcb version 0.47 2023-04-18 00:14:28 -05:00
William Hubbs
f6ed2c660c update news 2023-04-18 00:13:16 -05:00
Doug Freed
002bcf0b67 rc.conf: note SSD_* vars need exporting 2023-04-17 23:53:18 -05:00
William Hubbs
b9241988a7 init.d/rc.conf: make unicode default to yes 2023-03-07 00:48:43 -06:00
psykose
5ae4d4edb5 rc.conf: default to unicode console
it's the high year of 2023, after all.

closes #607
2023-03-06 22:41:36 -05:00
NRK
95b2948e6e seedrng: fix copyright year
this was mistakenly changed to 2023 instead of 2022-2023 in 63a5ee3d
2023-02-16 07:54:17 -05:00
anon
b73d326387 rc-status: comment consistecy 2023-02-15 22:51:40 -05:00
anon
476272be0c rc-status: all flags respect '-f' 2023-02-15 22:51:40 -05:00
NRK
63a5ee3d8c seedrng: fix memory leak reported by clang-tidy
`seed_dir` gets allocated via xstrdup but never gets freed - which
clang-tidy flags as a memory leak.

instead of free-ing the allocation, just don't allocate to begin with
since there's no need for it.

also bump the copyright year.
2023-02-05 00:38:20 -05:00
NRK
36cc40a9d6 bash-completions/rc-service: don't use grep
Co-authored-by: Mike Frysinger <vapier@gentoo.org>
Closes: https://github.com/OpenRC/openrc/issues/344
2023-02-02 19:37:09 -05:00
NRK
ae5e38dce5 start-stop-daemon: avoid malloc inside sig-handler
same rational as 459783bb

Bug: https://github.com/OpenRC/openrc/issues/589
2023-01-30 22:54:20 -05:00
NRK
5858f980c8 openrc-run: avoid malloc inside sig-handler
same rational as 459783bb

Bug: https://github.com/OpenRC/openrc/issues/589
2023-01-30 22:54:20 -05:00
Sam James
db96295e00 value: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
f5ed484920 swclock: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
00f90f2b0e supervise-daemon: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
b405681926 start-stop-daemon: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
d5700d036a shell_var: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
616f756ca8 shared: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
17cfb41d81 service: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
1bc87b7a7c seedrng: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
f3be11a00d rc-update: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
406ab2a4ca rc-status: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
7878a53542 rc-service: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
084e6b5e20 rc-depend: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
a7bd13145b rc-abort: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
28ecb38515 openrc-shutdown: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
91737be1ab openrc-run: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
fb6ffc5713 openrc: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
01acbe3c27 openrc-init: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
aa5c3ccd0b mountinfo: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
d795ea183f mark_service: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
5af3944440 librc: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
01bcdb43b6 libeinfo: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
bcd1975fe7 kill_all: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
57e194df4f is_older_than: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
dacd0ab189 is_newer_than: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
7cfe93d032 fstabinfo: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
893df75e30 einfo: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
c80d6bb2ed checkpath: missing includes from IWYU 2023-01-29 11:32:22 -06:00
Sam James
bfe38c98a8 src: shared: schedules: add missing includes to header
Needed for clang-tidy prep work, as it requires headers to work standalone
(which is useful anyway).
2023-01-28 22:14:30 -06:00
Sam James
e8a76ad6e6 src: shared: plugin: add missing includes to header
Needed for clang-tidy prep work, as it requires headers to work standalone
(which is useful anyway).
2023-01-28 22:14:30 -06:00
Sam James
7d63049adb src: shared: misc: add missing includes to header
Needed for clang-tidy prep work, as it requires headers to work standalone
(which is useful anyway).
2023-01-28 22:14:30 -06:00
Sam James
dc0b3157a9 src: shared: helpers: add missing includes to header
Needed for clang-tidy prep work, as it requires headers to work standalone
(which is useful anyway).
2023-01-28 22:14:30 -06:00