mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-13 08:58:33 +03:00
daemon: Change CWD to / before daemonizing
We were doing so for child processes but not for libvirtd itself.
This commit is contained in:
parent
e3fb2908cb
commit
99800e54b7
@ -3175,6 +3175,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (godaemon) {
|
||||
char ebuf[1024];
|
||||
|
||||
if (chdir("/") < 0) {
|
||||
VIR_ERROR(_("cannot change to root directory: %s"),
|
||||
virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((statuswrite = daemonForkIntoBackground()) < 0) {
|
||||
VIR_ERROR(_("Failed to fork as daemon: %s"),
|
||||
virStrerror(errno, ebuf, sizeof ebuf));
|
||||
|
Loading…
x
Reference in New Issue
Block a user