From 0d28d210d41af7e9ab6f8f4f65c3b3a67384c2ad Mon Sep 17 00:00:00 2001 From: "roberto@opensuse12" Date: Wed, 25 Apr 2012 08:02:24 +0200 Subject: [PATCH] another opensuse-related fix, build mimedict only if needed --- plugins/python/python_plugin.c | 7 ++++++- uwsgi.c | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 35a89a58..2a2bf3b2 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -150,7 +150,12 @@ int uwsgi_python_init() { #ifndef UWSGI_PYPY char *pyversion = strchr(Py_GetVersion(), '\n'); - uwsgi_log_initial("Python version: %.*s %s\n", pyversion-Py_GetVersion(), Py_GetVersion(), Py_GetCompiler()+1); + if (!pyversion) { + uwsgi_log_initial("Python version: %s %s\n", Py_GetVersion(), Py_GetCompiler()+1); + } + else { + uwsgi_log_initial("Python version: %.*s %s\n", pyversion-Py_GetVersion(), Py_GetVersion(), Py_GetCompiler()+1); + } #else uwsgi_log_initial("PyPy version: %s\n", PYPY_VERSION); #endif diff --git a/uwsgi.c b/uwsgi.c index 8459b674..2641087b 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -1863,17 +1863,21 @@ int uwsgi_start(void *v_argv) { sanitize_args(); // initialize workers - if (!uwsgi.mime_file) uwsgi_string_new_list(&uwsgi.mime_file, "/etc/mime.types"); - struct uwsgi_string_list *umd = uwsgi.mime_file; - while(umd) { - if (!access(umd->value, R_OK)) { - uwsgi_build_mime_dict(umd->value); + + + if (uwsgi.build_mime_dict) { + if (!uwsgi.mime_file) uwsgi_string_new_list(&uwsgi.mime_file, "/etc/mime.types"); + struct uwsgi_string_list *umd = uwsgi.mime_file; + while(umd) { + if (!access(umd->value, R_OK)) { + uwsgi_build_mime_dict(umd->value); + } + else { + uwsgi_log("!!! no %s file found !!!\n", umd->value); + } + umd = umd->next; } - else { - uwsgi_log("!!! no %s file found !!!\n", umd->value); - } - umd = umd->next; - } + } if (uwsgi.static_offload_to_thread) { pthread_attr_init(&uwsgi.static_offload_thread_attr); @@ -2276,6 +2280,7 @@ int uwsgi_start(void *v_argv) { uwsgi_sock = uwsgi_sock->next; } + if (uwsgi.chown_socket) { if (!uwsgi.master_as_root) { uwsgi_as_root();