Commit 45cf5f54 authored by Leigh Stoller's avatar Leigh Stoller

Remove the pidfile when exiting.

parent 0fad6182
/* /*
* EMULAB-COPYRIGHT * EMULAB-COPYRIGHT
* Copyright (c) 2003-2007 University of Utah and the Flux Group. * Copyright (c) 2003-2008 University of Utah and the Flux Group.
* All rights reserved. * All rights reserved.
*/ */
...@@ -198,11 +198,11 @@ main(int argc, char **argv) ...@@ -198,11 +198,11 @@ main(int argc, char **argv)
/* /*
* Stash the pid away. * Stash the pid away.
*/ */
if (pidfile) if (! pidfile) {
strcpy(buf, pidfile);
else
sprintf(buf, "%s/evproxy.pid", _PATH_VARRUN); sprintf(buf, "%s/evproxy.pid", _PATH_VARRUN);
fp = fopen(buf, "w"); pidfile = buf;
}
fp = fopen(pidfile, "w");
if (fp != NULL) { if (fp != NULL) {
fprintf(fp, "%d\n", getpid()); fprintf(fp, "%d\n", getpid());
(void) fclose(fp); (void) fclose(fp);
...@@ -214,6 +214,7 @@ main(int argc, char **argv) ...@@ -214,6 +214,7 @@ main(int argc, char **argv)
select(0, NULL, NULL, NULL, &tv); select(0, NULL, NULL, NULL, &tv);
} }
unlink(pidfile);
/* Unregister with the remote event system: */ /* Unregister with the remote event system: */
if (event_unregister(bosshandle) == 0) { if (event_unregister(bosshandle) == 0) {
......
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