try to honour chmod/chown socket in fd0 mode

This commit is contained in:
Unbit
2014-05-21 12:35:01 +02:00
parent fbc0a2775f
commit a0fafe7847
+18
View File
@@ -1760,6 +1760,24 @@ void uwsgi_bind_sockets() {
uwsgi_sock->fd = 0;
uwsgi_sock->bound = 1;
uwsgi_log("uwsgi socket %d inherited UNIX address %s fd 0\n", uwsgi_get_socket_num(uwsgi_sock), uwsgi_sock->name);
if (!uwsgi.is_a_reload) {
if (uwsgi.chown_socket) {
uwsgi_chown(uwsgi_sock->name, uwsgi.chown_socket);
}
if (uwsgi.chmod_socket) {
if (uwsgi.chmod_socket_value) {
if (chmod(uwsgi_sock->name, uwsgi.chmod_socket_value) != 0) {
uwsgi_error("inherit fd0: chmod()");
}
}
else {
uwsgi_log("chmod() fd0 socket to 666 for lazy and brave users\n");
if (chmod(uwsgi_sock->name, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) != 0) {
uwsgi_error("inherit fd0: chmod()");
}
}
}
}
}
else {
uwsgi_sock = uwsgi_new_socket(uwsgi_getsockname(0));