Commit Graph

1223 Commits

Author SHA1 Message Date
William Hubbs
038c03bef3 supervise-daemon: make an error message more verbose 2018-02-27 16:02:20 -06:00
William Hubbs
0506d68427 fstabinfo: fix an error message 2018-02-26 13:46:47 -06:00
William Hubbs
c3d666acaf openrc: remove unused #define's. 2018-02-26 13:14:31 -06:00
William Hubbs
e93b1d76d1 openrc: convert another execl() call to execlp() 2018-02-26 13:13:44 -06:00
William Hubbs
acf1e43f81 openrc-init: convert execl calls to execlp 2018-02-26 12:21:14 -06:00
William Hubbs
f383fd87b1 kill_all: change execl call to execlp 2018-02-24 17:02:02 -06:00
William Hubbs
cfded513cd openrc-init: set a default path
The default path provided by the system if one isn't set only includes
"/bin:/usr/bin". This adds the default path setting from sysvinit.
2018-02-24 16:24:08 -06:00
William Hubbs
aa7d3a7911 openrc: force deptree update for sysinit runlevel 2018-02-22 16:16:07 -06:00
William Hubbs
98262647a9 supervise-daemon: zero out the cmdline buffer when it is allocated 2018-02-22 12:54:21 -06:00
William Hubbs
5868abe97b start-stop-daemon: compiler warning cleanup 2018-02-21 18:16:56 -06:00
William Hubbs
71aad16256 openrc-run: clean up a compiler warning 2018-02-21 18:15:35 -06:00
William Hubbs
e275da84de supervise-daemon: remove references to PATH_MAX 2018-02-21 18:14:56 -06:00
William Hubbs
a6cc7f06cf rc.c: remove PATH_MAX references 2018-02-21 13:49:41 -06:00
William Hubbs
c1178c8eeb rc-selinux.c: remove references to path_max 2018-02-20 16:35:50 -06:00
William Hubbs
3c031ca978 rc-plubin.c: remove references to PATH_MAX 2018-02-20 16:01:15 -06:00
William Hubbs
8e02406d8f rc-misc.c: remove references to PATH_MAX 2018-02-20 14:22:29 -06:00
William Hubbs
8dbdabcc5e start-stop-daemon: clean up string handling 2018-02-16 14:04:40 -06:00
William Hubbs
488d8989c5 openrc-run: clean up string handling
- remove references to PATH_MAX
- use xasprintf to create strings
2018-02-15 15:26:40 -06:00
William Hubbs
9e14b35da8 rc-update: remove reference to PATH_MAX 2018-02-15 12:23:39 -06:00
William Hubbs
7b4879cb72 mountinfo: create strings with xasprintf 2018-02-14 16:56:19 -06:00
William Hubbs
74cfb455c5 kill_all: create strings with xasprintf 2018-02-14 16:50:24 -06:00
William Hubbs
0110487722 helpers.h: silence compiler warnings about xasprintf 2018-02-10 16:48:22 -06:00
William Hubbs
68b9b0bc2a xasprintf: exit if return value of vsnprintf is invalid 2018-02-10 14:49:40 -06:00
William Hubbs
4616f8f809 helpers.h: add xasprintf function
This is our own version of asprintf(). This original code was written by
Mike Frysinger, and I was able to modify it to use our memory helper
functions.

We need a version of this code because it is not available on glibc at
least without defining _GNU_SOURCE, and I would rather not do that.

This is the first step in improving string handling in OpenRC for #207.
2018-02-09 16:27:12 -06:00
William Hubbs
287d71bd25 helpers.h: style fix 2018-02-09 15:35:12 -06:00
William Hubbs
5dd1d39d20 typo fix 2018-01-24 10:56:33 -06:00
William Hubbs
1771bc2a83 checkpath: use fchown and fchmod to handle ownership and mode changes
This is related to #195.

This is an attempt to shorten the window for the first two issues
discussed by using a file descriptor which does not follow symbolic
links and using the fchmod and fchown calls instead of chown and chmod.
with.
2018-01-23 16:56:06 -06:00
William Hubbs
87c98ebb01 checkpath: fix lchown error message
X-Gentoo-Bug: 643084
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=643084
2018-01-16 13:34:37 -06:00
William Hubbs
4af5a80b0c _rc_deptree_load - return NULL if the stat() call is not successful
X-Gentoo-Bug: 643084
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=643084
2018-01-16 13:11:22 -06:00
William Hubbs
918d955fd2 checkpath: use lchown instead of chown
Checkpath should never follow symbolic links when changing ownership of a file.

This is for https://github.com/openrc/openrc/issues/195.
2018-01-09 17:25:28 -06:00
William Hubbs
a2447dfb42 rc-service: add --ifcrashed option
This works like the other --if options. If the service is crashed, run
the command.

This fixes #154.
2017-12-04 17:17:17 -06:00
Will Miles
a7c99506d9 Fix repeated dependency cache rebuild if clock skewed
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.
2017-11-30 13:56:54 -06:00
Doug Freed
c84ebb94d1
start-stop-daemon: properly handle missing pidfile
X-Gentoo-Bug: 639218
X-Gentoo-Bug-URL: https://bugs.gentoo.org/639218
2017-11-29 15:10:39 -05:00
William Hubbs
6bb7ebec48 fix FreeBSD build
This is for #186.
2017-11-27 11:10:00 -06:00
Doug Freed
a192caf88f rc-schedules: if given nothing to look for, stop
This avoids trying to kill everything.

X-Gentoo-Bug: 631958
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=631958
2017-11-19 11:05:30 -05:00
William Hubbs
971e82784c rc_find_pids: namespace fix
Ignore namespaces if there are errors reading either the pid namespace
for the current process or the process we aare testing.

This fixes https://github.com/openrc/openrc/issues/180.
2017-11-13 16:54:57 -06:00
William Hubbs
90d9ea656f start-stop-daemon: do not use do_stop to verify whether a daemon is running
X-Gentoo-Bug: 636574
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=636574
2017-11-07 15:30:34 -06:00
William Hubbs
a3d1c8a0e7 fix issue with --reexec call 2017-10-30 18:21:39 -05:00
William Hubbs
913b2ca537 supervise-daemon: use RC_SVCNAME as the first argument to the daemon
This makes ps show which service the supervisor is monitoring.
2017-10-27 19:22:09 -05:00
William Hubbs
3fe99c8b82 supervise-daemon: fix logging for reexec and the child command line 2017-10-27 17:34:29 -05:00
William Hubbs
27b8183de2 log as supervise-daemon not the service 2017-10-27 15:33:47 -05:00
William Hubbs
f32d8e1bfe supervise-daemon: clarify a log message 2017-10-26 17:01:17 -05:00
William Hubbs
d019f34a83 supervise-daemon: log the command line we run to spawn the child process 2017-10-26 13:57:04 -05:00
William Hubbs
bb9c481f02 supervise-daemon: log with the service name instead of "supervise-daemon" 2017-10-26 13:36:41 -05:00
William Hubbs
82da844b42 implement "unsupervised" status
The unsupervised status is to be used when a supervisor of a supervised
service dies but leaves the service daemon itself running.
2017-10-26 13:11:12 -05:00
William Hubbs
667a09983c supervise-daemon: remove child_pid from saved options during shutdown
This allows us to detect when the supervisor dies unexpectedly because
in that case child_pid will still exist.
2017-10-26 12:58:59 -05:00
William Hubbs
cf429ee359 rc_service_value_set: remove the option if NULL is the value
This allows the equivalent of "unsetting" a value for a service.
2017-10-26 12:54:37 -05:00
William Hubbs
3219ecd608 supervise-daemon: fix build issue for >=glibc-2.26
X-Gentoo-Bug: 635334
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=635334
2017-10-24 16:47:53 -05:00
William Hubbs
f5acc66db7 rc_find_pids: ignore pids that are not in our pid namespace
X-Gentoo-Bug: 634634
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=634634
2017-10-24 10:37:37 -05:00
William Hubbs
fdce4769f2 supervise-daemon: multiple fixes
- Harden against dying by handling all signals that would terminate the
program and adding --reexec support
- factor the supervisor into its own function
- fix test for whether we are already running
2017-10-24 10:26:18 -05:00