From 282d7ea8f8dcd7362643e9e8fca64ca249535ae7 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Thu, 22 Oct 2020 05:45:59 +0000 Subject: [PATCH] fix compiling by moving the pid code to the correct location.. --- ggatessh/ggatessh.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/ggatessh/ggatessh.c b/ggatessh/ggatessh.c index 2b1f27c..f8a2337 100644 --- a/ggatessh/ggatessh.c +++ b/ggatessh/ggatessh.c @@ -685,6 +685,27 @@ procreq: pthread_exit(NULL); } +static void +ggatessh_makepidfile(void) +{ + pid_t otherpid; + + if (!g_gate_verbose) { + if (ggatessh_pidfile == NULL) { + asprintf(&ggatessh_pidfile, _PATH_VARRUN "/ggatessh.ggate%d.pid", unit); + err(EXIT_FAILURE, "Cannot allocate memory for pidfile"); + } + pfh = pidfile_open(ggatessh_pidfile, 0600, &otherpid); + if (pfh == NULL) { + if (errno == EEXIST) { + errx(EXIT_FAILURE, "Daemon already running, pid: %jd.", + (intmax_t)otherpid); + } + err(EXIT_FAILURE, "Cannot open/create pidfile"); + } + } +} + static void mydaemon(void) { @@ -879,30 +900,9 @@ handle_params(int argc, char *argv[]) imgpath = argv[1]; } -void -ggatessh_makepidfile(void) -{ - - if (!g_gate_verbose) { - if (ggatessh_pidfile == NULL) { - asprintf(&ggatessh_pidfile, _PATH_VARRUN "/ggatessh.ggate%d.pid", unit); - err(EXIT_FAILURE, "Cannot allocate memory for pidfile"); - } - pfh = pidfile_open(ggatessh_pidfile, 0600, &otherpid); - if (pfh == NULL) { - if (errno == EEXIST) { - errx(EXIT_FAILURE, "Daemon already running, pid: %jd.", - (intmax_t)otherpid); - } - err(EXIT_FAILURE, "Cannot open/create pidfile"); - } - } -} - int main(int argc, char *argv[]) { - pid_t otherpid; int rc; if (argc < 2)