diff options
author | rofl0r <retnyg@gmx.net> | 2017-11-04 19:26:41 +0000 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2017-11-16 19:26:14 +0100 |
commit | 64b29c5f4e5cf35b9d03fd793e374e27cd83f0b2 (patch) | |
tree | 2c9c62bcf3d0f3ba6b19092fc19e6690896fbcf4 /src | |
parent | d97d486d53ce214ae952378308292f333b8c7a36 (diff) |
do not create a pidfile, if none is specified in config
some people want to run tinyproxy with minimal configuration from
the command line (and as non-root), but tinyproxy insists on writing
a pid file, which only makes sense for usage as a service, hereby
forcing the user to either run it as root so it can write to the
default location, or start editing the default config file to work
around it.
and if no pidfile is specified in the config, it frankly doesn't
make sense to force creation of one anyway.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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)); |