Skip to content

Commit

Permalink
CHANGE: Use full path GVMD_PID_PATH for PID files
Browse files Browse the repository at this point in the history
The calls of pidfile_create and pidfile_remove are adjusted to use a
full path defined by GVMD_PID_PATH.
  • Loading branch information
timopollmeier committed Nov 16, 2021
1 parent 35d3b5a commit a9be3d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -184,6 +184,10 @@ if (NOT GVM_RUN_DIR)
set (GVM_RUN_DIR "/run/gvm")
endif (NOT GVM_RUN_DIR)

if (NOT GVMD_PID_PATH)
set (GVMD_PID_PATH "/run/gvmd/gvmd.pid")
endif (NOT GVMD_PID_PATH)

if (NOT GVM_FEED_LOCK_PATH)
set (GVM_FEED_LOCK_PATH "${GVM_STATE_DIR}/feed-update.lock")
endif (NOT GVM_FEED_LOCK_PATH)
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Expand Up @@ -370,6 +370,10 @@ if (GVM_RUN_DIR)
add_definitions (-DGVM_RUN_DIR="${GVM_RUN_DIR}")
endif (GVM_RUN_DIR)

if (GVMD_PID_PATH)
add_definitions (-DGVMD_PID_PATH="${GVMD_PID_PATH}")
endif (GVMD_PID_PATH)

if (GVM_SYSCONF_DIR)
add_definitions (-DGVM_SYSCONF_DIR="${GVM_SYSCONF_DIR}")
endif (GVM_SYSCONF_DIR)
Expand Down
4 changes: 2 additions & 2 deletions src/gvmd.c
Expand Up @@ -925,7 +925,7 @@ cleanup ()
if (log_config) log_config_free ();

/* Delete pidfile if this process is the parent. */
if (is_parent == 1) pidfile_remove ("gvmd");
if (is_parent == 1) pidfile_remove (GVMD_PID_PATH);
}

#ifndef NDEBUG
Expand Down Expand Up @@ -2966,7 +2966,7 @@ gvmd (int argc, char** argv)

/* Set our pidfile. */

if (pidfile_create ("gvmd")) exit (EXIT_FAILURE);
if (pidfile_create (GVMD_PID_PATH)) exit (EXIT_FAILURE);

/* Setup global variables. */

Expand Down

0 comments on commit a9be3d7

Please sign in to comment.