summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--etc/tinyproxy.conf.in1
-rw-r--r--src/main.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/etc/tinyproxy.conf.in b/etc/tinyproxy.conf.in
index 2cde69e..fe0c117 100644
--- a/etc/tinyproxy.conf.in
+++ b/etc/tinyproxy.conf.in
@@ -121,6 +121,7 @@ LogLevel Info
#
# PidFile: Write the PID of the main tinyproxy thread to this file so it
# can be used for signalling purposes.
+# If not specified, no pidfile will be written.
#
#PidFile "@localstatedir@/run/tinyproxy/tinyproxy.pid"
diff --git a/src/main.c b/src/main.c
index ae2a3a8..50cacca 100644
--- a/src/main.c
+++ b/src/main.c
@@ -356,7 +356,7 @@ static void initialize_config_defaults (struct config_s *conf)
conf->stathost = safestrdup (TINYPROXY_STATHOST);
conf->idletimeout = MAX_IDLE_TIME;
conf->logf_name = safestrdup (LOCALSTATEDIR "/log/tinyproxy/tinyproxy.log");
- conf->pidpath = safestrdup (LOCALSTATEDIR "/run/tinyproxy/tinyproxy.pid");
+ conf->pidpath = NULL;
}
/**
@@ -496,7 +496,7 @@ main (int argc, char **argv)
child_close_sock ();
/* Remove the PID file */
- if (unlink (config.pidpath) < 0) {
+ if (config.pidpath != NULL && unlink (config.pidpath) < 0) {
log_message (LOG_WARNING,
"Could not remove PID file \"%s\": %s.",
config.pidpath, strerror (errno));