Skip to content

Commit

Permalink
preserve the current location in daemon mode
Browse files Browse the repository at this point in the history
This is done, already if libdir is relative.

closes: #1717

Reported-by: Nicolas Richard <kournikolas@yahoo.fr>
  • Loading branch information
Gonéri Le Bouder committed Jul 20, 2012
1 parent 0cac1f8 commit d58c7f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/FusionInventory/Agent.pm
Expand Up @@ -143,8 +143,17 @@ sub init {
$logger->error("Can't load Proc::Daemon. Is the module installed?");
exit 1;
}

my $cwd = getcwd();
Proc::Daemon::Init();
$logger->debug("Daemon started");


# If we use relative path, we must stay in the current directory
if (substr( $params{libdir}, 0, 1 ) ne '/') {
chdir($cwd);
}

if ($self->_isAlreadyRunning()) {
$logger->debug("An agent is already runnnig, exiting...");
exit 1;
Expand Down

0 comments on commit d58c7f0

Please sign in to comment.