mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-03 15:38:36 +00:00
fixed a stupid (really stupid) bug in uwsgi.core allocation
This commit is contained in:
@@ -1715,25 +1715,6 @@ int uwsgi_start(void *v_argv) {
|
||||
uwsgi.mypid = getpid();
|
||||
masterpid = uwsgi.mypid;
|
||||
|
||||
if (uwsgi.cores > 1) {
|
||||
for (i = 0; i < uwsgi.numproc + 1; i++) {
|
||||
uwsgi.core = (struct uwsgi_core **) mmap(NULL, sizeof(struct uwsgi_core *) * uwsgi.cores, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
|
||||
if (!uwsgi.core) {
|
||||
uwsgi_error("mmap()");
|
||||
exit(1);
|
||||
}
|
||||
memset(uwsgi.core, 0, sizeof(struct uwsgi_core *) * uwsgi.cores);
|
||||
|
||||
for (j = 0; j < uwsgi.cores; j++) {
|
||||
uwsgi.core[j] = (struct uwsgi_core *) mmap(NULL, sizeof(struct uwsgi_core), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
|
||||
if (!uwsgi.core[j]) {
|
||||
uwsgi_error("mmap()");
|
||||
exit(1);
|
||||
}
|
||||
memset(uwsgi.core[j], 0, sizeof(struct uwsgi_core));
|
||||
}
|
||||
}
|
||||
}
|
||||
uwsgi.workers[0].pid = masterpid;
|
||||
|
||||
/*
|
||||
@@ -1996,6 +1977,12 @@ int uwsgi_start(void *v_argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
uwsgi.core = uwsgi_malloc(sizeof(struct uwsgi_core *) * uwsgi.cores);
|
||||
for (j = 0; j < uwsgi.cores; j++) {
|
||||
uwsgi.core[j] = uwsgi_malloc(sizeof(struct uwsgi_core));
|
||||
memset(uwsgi.core[j], 0, sizeof(struct uwsgi_core));
|
||||
}
|
||||
|
||||
if (uwsgi.master_as_root) {
|
||||
uwsgi_as_root();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user