# HG changeset patch # User Franz Glasner # Date 1592161258 -7200 # Node ID 2b8606346ec7cd31f3862864a8eda1c4c97426ab # Parent 278470dc420de98ee39968c0a7cfe73bdd1212a5 Apply patch: logging: use fchmod instead of chmod to avoid TOCTOU race. commit 39bea1de5d377cf4e369421aebec6c1e5482543c diff -r 278470dc420d -r 2b8606346ec7 uwsginl/files/patch-core_logging.c --- /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()"); + } + } + }