1
0
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:
Jiri Denemark 2010-12-13 11:18:45 +01:00
parent e3fb2908cb
commit 99800e54b7

View File

@ -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));