Commit ab69b755 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(main): Use pidfile to simplify code.

parent 3a9ebaa7
/*
* $Id: updateLysKOM.c,v 1.8 1998/12/26 22:41:11 byers Exp $
* $Id: updateLysKOM.c,v 1.9 1999/04/17 00:16:46 ceder Exp $
* Copyright (C) 1994, 1995 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -51,6 +51,7 @@
#include <unistd.h>
#include "ldifftime.h"
#include "pidfile.h"
static void
checkstatus(FILE *fp,
......@@ -158,7 +159,7 @@ main (int argc,
{
case 'V':
case 'v':
fprintf(stderr, "updateLysKOM %d $Revision: 1.8 $\n",
fprintf(stderr, "updateLysKOM %d $Revision: 1.9 $\n",
#include "version.incl"
);
exit(0);
......@@ -167,23 +168,11 @@ main (int argc,
fprintf(stderr, "usage: %s [-V]\n", argv[0]);
}
fp = fopen(DEFAULT_PREFIX "/etc/pid", "r");
if (fp == NULL)
pid = read_pid_file(DEFAULT_PREFIX "/etc/pid", argv[0]);
if (pid == 1)
{
fprintf(stderr, "%s: warning: %s: ", argv[0],
DEFAULT_PREFIX "/etc/pid");
perror("");
pid = 0;
}
else
{
pid = 0;
fscanf(fp, "%lu", &pid);
if (pid < 2)
{
fprintf(stderr, "%s: got pid %ld.\n", argv[0], pid);
exit(1);
}
fprintf(stderr, "%s: got pid %ld.\n", argv[0], pid);
exit(1);
}
fp = fopen(DEFAULT_PREFIX "/etc/status", "r");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment