ports/www/tinyproxy/files/patch-src-main.c
Kurt Jaeger c8d1ddf6c0 www/tinyproxy: update 1.8.3 -> 1.8.4
- new WWW

PR:		207051
Changes:	https://github.com/tinyproxy/tinyproxy/releases
Submitted by:	jason.mann+freebsd@gmail.com
Approved by:	sunpoet (maintainer timeout)
2016-11-22 17:58:54 +00:00

32 lines
1.1 KiB
C

--- src/main.c.orig 2014-12-13 00:57:23 UTC
+++ src/main.c
@@ -417,12 +417,9 @@ main (int argc, char **argv)
exit (EX_OSERR);
}
- /* Switch to a different user if we're running as root */
- if (geteuid () == 0)
- change_user (argv[0]);
- else
- log_message (LOG_WARNING,
- "Not running as root, so not changing UID/GID.");
+ /* To get this to run correctly on FreeBSD, we must
+ create the PID and log files before we drop privileges.
+ Other ideas are welcome */
/* Create log file after we drop privileges */
if (setup_logging ()) {
@@ -438,6 +435,13 @@ main (int argc, char **argv)
}
}
+ /* Switch to a different user if we're running as root */
+ if (geteuid () == 0)
+ change_user (argv[0]);
+ else
+ log_message (LOG_WARNING,
+ "Not running as root, so not changing UID/GID.");
+
if (child_pool_create () < 0) {
fprintf (stderr,
"%s: Could not create the pool of children.\n",