summaryrefslogtreecommitdiffstats
path: root/src/openvpn/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvpn/misc.c')
-rw-r--r--src/openvpn/misc.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index 5627cb9..4fdbf17 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -127,30 +127,21 @@ run_up_down (const char *command,
gc_free (&gc);
}
-/* Get the file we will later write our process ID to */
+/* Write our PID to a file */
void
-get_pid_file (const char* filename, struct pid_state *state)
+write_pid (const char *filename)
{
- CLEAR (*state);
if (filename)
{
- state->fp = platform_fopen (filename, "w");
- if (!state->fp)
+ unsigned int pid = 0;
+ FILE *fp = platform_fopen (filename, "w");
+ if (!fp)
msg (M_ERR, "Open error on pid file %s", filename);
- state->filename = filename;
- }
-}
-/* Write our PID to a file */
-void
-write_pid (const struct pid_state *state)
-{
- if (state->filename && state->fp)
- {
- unsigned int pid = platform_getpid ();
- fprintf(state->fp, "%u\n", pid);
- if (fclose (state->fp))
- msg (M_ERR, "Close error on pid file %s", state->filename);
+ pid = platform_getpid ();
+ fprintf(fp, "%u\n", pid);
+ if (fclose (fp))
+ msg (M_ERR, "Close error on pid file %s", filename);
}
}