Browse Source

fix compiling by moving the pid code to the correct location..

tags/ggatessh-v1.0.0
John-Mark Gurney 4 years ago
parent
commit
282d7ea8f8
1 changed files with 21 additions and 21 deletions
  1. +21
    -21
      ggatessh/ggatessh.c

+ 21
- 21
ggatessh/ggatessh.c View File

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


Loading…
Cancel
Save