changeset 78:2b8606346ec7

Apply patch: logging: use fchmod instead of chmod to avoid TOCTOU race. commit 39bea1de5d377cf4e369421aebec6c1e5482543c
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 14 Jun 2020 21:00:58 +0200
parents 278470dc420d
children badbe8b61265
files uwsginl/files/patch-core_logging.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsginl/files/patch-core_logging.c	Sun Jun 14 21:00:58 2020 +0200
@@ -0,0 +1,13 @@
+--- core/logging.c.orig	2020-06-14 18:59:21 UTC
++++ core/logging.c
+@@ -291,8 +291,8 @@ void logto(char *logfile) {
+ 		uwsgi.logfile = logfile;
+ 
+ 		if (uwsgi.chmod_logfile_value) {
+-			if (chmod(uwsgi.logfile, uwsgi.chmod_logfile_value)) {
+-				uwsgi_error("chmod()");
++			if (fchmod(fd, uwsgi.chmod_logfile_value)) {
++				uwsgi_error("fchmod()");
+ 			}
+ 		}
+ 	}