mirror of
https://gitlab.com/chrony/chrony.git
synced 2026-01-20 21:00:20 -05:00
privops: refactor initialisation/finalisation
Rename PRV_Initialise() to PRV_StartHelper() and add a new initialisation function, which just sets the helper fd to -1. Move the initialision/finalisation calls from the system drivers to main.c. If privops is not included in the build, define empty macros for the function names, so their calls don't have to be wrapped in #ifdefs.
This commit is contained in:
12
privops.c
12
privops.c
@@ -91,7 +91,7 @@ typedef struct {
|
||||
} u;
|
||||
} PrvResponse;
|
||||
|
||||
static int helper_fd = -1;
|
||||
static int helper_fd;
|
||||
static pid_t helper_pid;
|
||||
|
||||
static int
|
||||
@@ -477,11 +477,19 @@ PRV_BindSocket(int sock, struct sockaddr *address, socklen_t address_len)
|
||||
|
||||
/* ======================================================================= */
|
||||
|
||||
void
|
||||
PRV_Initialise(void)
|
||||
{
|
||||
helper_fd = -1;
|
||||
}
|
||||
|
||||
/* ======================================================================= */
|
||||
|
||||
/* DAEMON - setup socket(s) then fork to run the helper */
|
||||
/* must be called before privileges are dropped */
|
||||
|
||||
void
|
||||
PRV_Initialise(void)
|
||||
PRV_StartHelper(void)
|
||||
{
|
||||
pid_t pid;
|
||||
int fd, sock_pair[2];
|
||||
|
||||
Reference in New Issue
Block a user