diff --git a/core/master_utils.c b/core/master_utils.c index 3b940a36..ce4a290a 100644 --- a/core/master_utils.c +++ b/core/master_utils.c @@ -724,7 +724,7 @@ void uwsgi_manage_command_cron(time_t now) { } } if (current_cron->month < 0) { - if ((uwsgi_cron_delta->tm_hour % abs(current_cron->month)) == 0) { + if ((uwsgi_cron_delta->tm_mon % abs(current_cron->month)) == 0) { uc_month = uwsgi_cron_delta->tm_mon; } } @@ -1202,6 +1202,7 @@ struct uwsgi_stats *uwsgi_master_generate_stats() { #endif #ifdef UWSGI_SSL + struct uwsgi_legion *legion = NULL; if (uwsgi.legions) { if (uwsgi_stats_comma(us)) @@ -1213,7 +1214,7 @@ struct uwsgi_stats *uwsgi_master_generate_stats() { if (uwsgi_stats_list_open(us)) goto end; - struct uwsgi_legion *legion = uwsgi.legions; + legion = uwsgi.legions; while (legion) { if (uwsgi_stats_object_open(us)) goto end; @@ -1283,30 +1284,30 @@ struct uwsgi_stats *uwsgi_master_generate_stats() { struct uwsgi_legion_node *node = legion->nodes_head; while (node) { if (uwsgi_stats_object_open(us)) - goto end; + goto unlock_legion_mutex; if (uwsgi_stats_keyvaln_comma(us, "name", node->name, node->name_len)) - goto end; + goto unlock_legion_mutex; if (uwsgi_stats_keyval_comma(us, "uuid", node->uuid)) - goto end; + goto unlock_legion_mutex; if (uwsgi_stats_keylong_comma(us, "valor", (unsigned long long) node->valor)) - goto end; + goto unlock_legion_mutex; if (uwsgi_stats_keylong_comma(us, "checksum", (unsigned long long) node->checksum)) - goto end; + goto unlock_legion_mutex; if (uwsgi_stats_keylong(us, "last_seen", (unsigned long long) node->last_seen)) - goto end; + goto unlock_legion_mutex; if (uwsgi_stats_object_close(us)) - goto end; + goto unlock_legion_mutex; node = node->next; if (node) { if (uwsgi_stats_comma(us)) - goto end; + goto unlock_legion_mutex; } } pthread_mutex_unlock(&legion->lock); @@ -1335,6 +1336,11 @@ struct uwsgi_stats *uwsgi_master_generate_stats() { goto end; return us; +#ifdef UWSGI_SSL +unlock_legion_mutex: + if (legion) + pthread_mutex_unlock(&legion->lock); +#endif end: free(us->base); free(us); diff --git a/core/utils.c b/core/utils.c index 248efab5..b9c779b6 100644 --- a/core/utils.c +++ b/core/utils.c @@ -997,8 +997,10 @@ int wsgi_req_accept(int queue, struct wsgi_request *wsgi_req) { if (timeout > 0) { uwsgi_heartbeat(); // no need to continue if timed-out - if (ret == 0) + if (ret == 0) { + thunder_unlock; return -1; + } } #ifdef UWSGI_THREADING diff --git a/lib/linux_ns.c b/lib/linux_ns.c index 149aca88..2aa8cb82 100644 --- a/lib/linux_ns.c +++ b/lib/linux_ns.c @@ -201,10 +201,16 @@ void linux_namespace_jail() { unmounted = 0; procmounts = fopen("/proc/self/mounts", "r"); + if (!procmounts) + break; while (fgets(line, 1024, procmounts) != NULL) { delim0 = strchr(line, ' '); + if (!delim0) + continue; delim0++; delim1 = strchr(delim0, ' '); + if (!delim1) + continue; *delim1 = 0; // and now check for keep-mounts if (uwsgi_is_a_keep_mount(delim0)) continue; diff --git a/plugins/carbon/carbon.c b/plugins/carbon/carbon.c index b6bf02be..b5573880 100644 --- a/plugins/carbon/carbon.c +++ b/plugins/carbon/carbon.c @@ -107,6 +107,7 @@ int carbon_write(int *fd, char *fmt,...) { int rlen; rlen = vsnprintf(ptr, 4096, fmt, ap); + va_end(ap); if (rlen < 1) return 0;