aboutsummaryrefslogtreecommitdiff
path: root/src/librc/librc-depend.c
AgeCommit message (Collapse)Author
2023-01-29librc: missing includes from IWYUSam James
2022-12-07librc-depend: fix -Wmismatched-deallocSam James
Despite this being a 'deptree', it's actually xmalloc'd in the same function (rc_deptree_update), and so should be free'd, not rc_deptree_free'd, as rc_deptree_load* wasn't used to allocate it. ``` [71/213] Compiling C object src/librc/librc.so.1.p/librc-depend.c.o ../src/librc/librc-depend.c: In function ‘rc_deptree_update’: ../src/librc/librc-depend.c:1077:9: warning: ‘rc_deptree_free’ called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc] 1077 | rc_deptree_free(deptree); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../src/shared/misc.h:29, from ../src/librc/librc.h:57, from ../src/librc/librc-depend.c:21: In function ‘xmalloc’, inlined from ‘rc_deptree_update’ at ../src/librc/librc-depend.c:775:12: ../src/shared/helpers.h:64:23: note: returned from ‘malloc’ 64 | void *value = malloc(size); | ^~~~~~~~~~~~ ``` This fixes #563.
2022-05-08librc: mark rc_deptree_* functions as mallocsSam James
(This is analogous to the rc_stringlist change.) This gives a hint to the compiler that allocations (return values) from this function should be paired with a corresponding dealloc/free function. Signed-off-by: Sam James <sam@gentoo.org>
2021-12-21code style: remove space after unary "not" operatorMatt Whitlock
There are no semantic changes in this commit. Suggested-by: Mike Frysinger <vapier@gentoo.org> See: https://github.com/OpenRC/openrc/pull/435#pullrequestreview-727035394
2021-12-20use HEAD in git URIs to point to the default branchMike Frysinger
This makes the URIs shorter and dynamic: whatever the default branch the repo uses will be used.
2019-02-26remove hidden-visibility.hWilliam Hubbs
I am removing this on the advice of a member of the Gentoo toolchain team. It was explained to me that this doesn't offer any significant benefits to OpenRC. If anyone ffeels differently, please open a pull request reverting this and adding an explanation of what it does and how to know which functions to mark hidden in the future. This fixes #301.
2019-02-21librc/librc-depend.c: fix NULL pointer dereferenceGeorgy Yakovlev
In some cases deptree or depinfo can be NULL, check before dereferencing. Fixes https://github.com/OpenRC/openrc/issues/293 Fixes https://github.com/OpenRC/openrc/pulls/294 X-Gentoo-Bug: 659906 X-Gentoo-Bug-URL: https://bugs.gentoo.org/659906
2018-12-27fix leading whitespacephilhofer
Clean up code indented with mixed tabs and spaces. No actual code changes. This fixes #280.
2017-11-30Fix repeated dependency cache rebuild if clock skewedWill Miles
rc_deptree_update_needed would return early as soon as it found any file newer than the existing dependency cache. Unfortunately, the first file found may not be the newest one there; so the clock skew workaround in rc-misc:_rc_deptree_load would be given a timestamp that was still too old. This fix forces a full scan of all relevant files, so as to ensure that we return a timestamp that will allow the clock skew fix to operate. The runtime cost is no worse than the case where the cache is up to date (ie. we must check every possible file). This fixes #161.
2016-01-21librc: Complain when a real and virtual service have the same nameWilliam Hubbs
2016-01-19librc: move system detection code into rc_sys and use itDoug Freed
This fixes an issue where librc code was calling code that only existed in the rc binary. This reverts commits 8addd79 and 9f6e056 This fixes #75.
2016-01-18Revert "librc: fix librc-depend functions to call rc_sys"William Hubbs
This reverts commit 73482cf13a338051606788957cbd0031ac850c70.
2016-01-18librc: fix librc-depend functions to call rc_sysWilliam Hubbs
2015-12-21Convert OpenRC to a centralized copyright/license structureWilliam Hubbs
In the past, OpenRC was a hybrid of a centralized and file-scope license/copyright structure. I followed the instructions from the Software Freedom Law Center [1] to convert to a Centralized structure where possible, for easier future maintenance. [1] https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
2015-12-08Convert rc_sys() calls to detect_container() and detect_vm()William Hubbs
2015-11-12Implement "want" dependencyIan Stakenvicius
The want dependency is similar to the use dependency. If a service script, for example called service1, adds "want service2" to its depend function, OpenRC will attempt to start service2, if it exists on the system, when service1 is started. However, service1 will start regardless of the status of service2. X-Gentoo-Bug: 406021 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=406021
2014-10-23Bundle <sys/queue.h> from NetBSDAnthony G. Basile
We are bundling this to allow building on musl-based systems since musl does not include <sys/queue.h>.
2013-10-04librc: fix off-by-one bugNatanael Copa
We need allocate space for both the added leading '-' and the trailing '\0'. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2012-10-04set the RC_UNAME environment variable when updating dependenciesWilliam Hubbs
This is needed because the network script uses this variable in the depend() function but it wasn't exported when this was run. Reported-by: <aaly90@gmail.com>
2012-04-26Reduce overhead by leaving rc_deptree_update_needed() as soon as possibleChristian Ruppert
There's no need to check any further if we're returning true anyway. Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
2011-06-29drop useless "All rights reserved" noticeMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-28Use RC_CONF instead of the hardcoded /etc/rc.confChristian Ruppert
2011-05-28librc: tweak style: foo () -> foo()Mike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-09typo fixWilliam Hubbs
X-Gentoo-Bug: 217999 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=217999
2011-01-17Bug #351570: Fix hidden functions visibility for rc_deptree_load_file.Robin H. Johnson
2011-01-17Clean up all trailing whitespace in src/.Robin H. Johnson
2011-01-17Factor out new function rc_deptree_load_file to aid in debugging deptree ↵Robin H. Johnson
files from users. Loads from a given filename instead of the hardcoded RC_DEPTREE_CACHE define.
2009-11-14Only allow one service to be provided by default.Roy Marples
Fixes Gentoo #293139.
2009-07-20Don't provide ourself, fixes #190Roy Marples
2009-07-01We should use -feature instead of nofeature.Roy Marples
This matches the ifconfig and Gentoo USE flag syntax and is hopefully easier to read. Fixes #178.
2009-05-23Move non compiled libraries from /lib/rc to /libexec/rcRoy Marples
OpenRC version is now stored as plaintext in /libexec/rc/version Plugins (cursplash, splashutils) will have to be re-compiled to pickup the new directories. State data needs to be moved from /lib/rc/init.d to /libexec/rc/init.d as well.
2009-05-01Add (c) to CopyrightRoy Marples
2009-04-28Don't start services when their need dependency is brokenRoy Marples
2009-02-12Fix return value for tests.Roy Marples
2009-01-13rc_newer/older_than only report file if time_t is a pointer, so itRoy Marples
should take precedence in the argument list.
2009-01-12We now warn about clock skewsRoy Marples
rc-update -u will force a regen of the dep tree rc_newer_than and rc_olderthan now take another two parameters for newest/oldest file and mtime
2008-11-04Ignore after dependencies for shutdown when not in the runlevel.Roy Marples
2008-11-03Avoid depends not in the runlevel for sysinit and shutdown.Roy Marples
2008-11-03Add a new shutdown runlevel, Gentoo #224537.Roy Marples
Split halt.sh into halt, killprocs, romount and savecache services. The reboot runlevel is removed but mapped to shutdown. The halt script should be moved to the sysvinit package.
2008-10-10Remove coldplug and just have hotplug which is a list of allowed/disallowed ↵Roy Marples
services. Makes things much easier.
2008-10-10sysinit is now a real runlevel that handles things like udev, dmesg andRoy Marples
mounting various bits in /dev and /sys. init.sh JUST mounts /lib/rc/init.d (and /proc for Linux systems) To make development of this easier we now return an empty RC_STRINGLIST instead of a NULL for empty things. If you don't have a udev init script installed, don't reboot your box OR roll back to an older OpenRC version.
2008-07-07Punt STAILQ and just use TAILQ so we're a bit more portable.Roy Marples
2008-07-03Add older_than function to complement newer_than function. Also make the ↵Roy Marples
userland instance reversed to be compatable with current baselayout, which truely does suck.
2008-06-10fuzzy dependency ordering should be started, starting, stopped whilst ↵Roy Marples
checking runlevel, bootlevel, any at each stage.
2008-06-05Remove broken before dependencies, Gentoo #224171.Roy Marples
2008-06-04Use addu instead of another loop.Roy Marples
2008-06-04Only add a backreference if it doesn't already exist.Roy Marples
2008-06-04No need to check type twice like this.Roy Marples
2008-06-04Style.Roy Marples
2008-05-12The real fix for the last commit is to uncomment some code - d'oh.Roy Marples