src/core/ngx_cycle.c:273: error: Buffer Overrun L2
  Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`.

src/core/ngx_cycle.c:267:9: Unknown value from: ngx_conf_parse
265.     }
266. 
267.     if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) {
             ^
268.         ngx_destroy_cycle_pools(&conf);
269.         return NULL;

src/core/ngx_cycle.c:273:9: Call
271. 
272.     if (ngx_test_config) {
273.         ngx_log_error(NGX_LOG_INFO, log, 0,
             ^
274.                       "the configuration file %s syntax is ok",
275.                       cycle->conf_file.data);

src/core/ngx_log.c:67:1: Array declaration
  65. #if (NGX_HAVE_VARIADIC_MACROS)
  66. 
  67. void
      ^
  68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
  69.     const char *fmt, ...)

src/core/ngx_log.c:88:5: Assignment
  86.     }
  87. 
  88.     last = errstr + NGX_MAX_ERROR_STR;
          ^
  89. 
  90.     ngx_memcpy(errstr, ngx_cached_err_log_time.data,

src/core/ngx_log.c:133:13: Call
  131.                                            ? " (%d: " : " (%Xd: ", err);
  132. #else
  133.         p = ngx_snprintf(p, last - p, " (%d: ", err);
                   ^
  134. #endif
  135. 

src/core/ngx_string.c:109:1: Parameter `max`
    107. 
    108. 
    109. u_char * ngx_cdecl
         ^
    110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)
    111. {

src/core/ngx_string.c:116:9: Call
    114. 
    115.     va_start(args, fmt);
    116.     p = ngx_vsnprintf(buf, max, fmt, args);
                 ^
    117.     va_end(args);
    118. 

src/core/ngx_string.c:123:1: <Length trace>
121. 
122. 
123. u_char *
     ^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {

src/core/ngx_string.c:123:1: Parameter `*buf`
      121. 
      122. 
      123. u_char *
           ^
      124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
      125. {

src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core` 
      242.                 if (slen == (size_t) -1) {
      243.                     while (*p && buf < last) {
      244.                         *buf++ = *p++;
                                   ^
      245.                     }
      246. 

u_char *
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
{
    u_char                *p, zero, *last;
    int                    d;
    float                  f, scale;
    size_t                 len, slen;
    int64_t                i64;
    uint64_t               ui64;
    ngx_msec_t             ms;
    ngx_uint_t             width, sign, hex, max_width, frac_width, i;
    ngx_str_t             *v;
    ngx_variable_value_t  *vv;
    if (max == 0) {
        return buf;
    }
    last = buf + max;
    while (*fmt && buf < last) {
        if (*fmt == '%') {
            i64 = 0;
            ui64 = 0;
            zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
            width = 0;
            sign = 1;
            hex = 0;
            max_width = 0;
            frac_width = 0;
            slen = (size_t) -1;
            while (*fmt >= '0' && *fmt <= '9') {
                width = width * 10 + *fmt++ - '0';
            }
            for ( ;; ) {
                switch (*fmt) {
                case 'u':
                    sign = 0;
                    fmt++;
                    continue;
                case 'm':
                    max_width = 1;
                    fmt++;
                    continue;
                case 'X':
                    hex = 2;
                    sign = 0;
                    fmt++;
                    continue;
                case 'x':
                    hex = 1;
                    sign = 0;
                    fmt++;
                    continue;
                case '.':
                    fmt++;
                    while (*fmt >= '0' && *fmt <= '9') {
                        frac_width = frac_width * 10 + *fmt++ - '0';
                    }
                    break;
                case '*':
                    slen = va_arg(args, size_t);
                    fmt++;
                    continue;
                default:
                    break;
                }
                break;
            }
            switch (*fmt) {
            case 'V':
                v = va_arg(args, ngx_str_t *);
                len = v->len;
                len = (buf + len < last) ? len : (size_t) (last - buf);
                buf = ngx_cpymem(buf, v->data, len);
                fmt++;
                continue;
            case 'v':
                vv = va_arg(args, ngx_variable_value_t *);
                len = vv->len;
                len = (buf + len < last) ? len : (size_t) (last - buf);
                buf = ngx_cpymem(buf, vv->data, len);
                fmt++;
                continue;
            case 's':
                p = va_arg(args, u_char *);
                if (slen == (size_t) -1) {
                    while (*p && buf < last) {
                        *buf++ = *p++;
                    }
                } else {
                    len = (buf + slen < last) ? slen : (size_t) (last - buf);
                    buf = ngx_cpymem(buf, p, len);
                }
                fmt++;
                continue;
            case 'O':
                i64 = (int64_t) va_arg(args, off_t);
                sign = 1;
                break;
            case 'P':
                i64 = (int64_t) va_arg(args, ngx_pid_t);
                sign = 1;
                break;
            case 'T':
                i64 = (int64_t) va_arg(args, time_t);
                sign = 1;
                break;
            case 'M':
                ms = (ngx_msec_t) va_arg(args, ngx_msec_t);
                if ((ngx_msec_int_t) ms == -1) {
                    sign = 1;
                    i64 = -1;
                } else {
                    sign = 0;
                    ui64 = (uint64_t) ms;
                }
                break;
            case 'z':
                if (sign) {
                    i64 = (int64_t) va_arg(args, ssize_t);
                } else {
                    ui64 = (uint64_t) va_arg(args, size_t);
                }
                break;
            case 'i':
                if (sign) {
                    i64 = (int64_t) va_arg(args, ngx_int_t);
                } else {
                    ui64 = (uint64_t) va_arg(args, ngx_uint_t);
                }
                if (max_width) {
                    width = NGX_INT_T_LEN;
                }
                break;
            case 'd':
                if (sign) {
                    i64 = (int64_t) va_arg(args, int);
                } else {
                    ui64 = (uint64_t) va_arg(args, u_int);
                }
                break;
            case 'l':
                if (sign) {
                    i64 = (int64_t) va_arg(args, long);
                } else {
                    ui64 = (uint64_t) va_arg(args, u_long);
                }
                break;
            case 'D':
                if (sign) {
                    i64 = (int64_t) va_arg(args, int32_t);
                } else {
                    ui64 = (uint64_t) va_arg(args, uint32_t);
                }
                break;
            case 'L':
                if (sign) {
                    i64 = va_arg(args, int64_t);
                } else {
                    ui64 = va_arg(args, uint64_t);
                }
                break;
            case 'A':
                if (sign) {
                    i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
                } else {
                    ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
                }
                if (max_width) {
                    width = NGX_ATOMIC_T_LEN;
                }
                break;
            case 'f':
                f = (float) va_arg(args, double);
                if (f < 0) {
                    *buf++ = '-';
                    f = -f;
                }
                ui64 = (int64_t) f;
                buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
                if (frac_width) {
                    if (buf < last) {
                        *buf++ = '.';
                    }
                    scale = 1.0;
                    for (i = 0; i < frac_width; i++) {
                        scale *= 10.0;
                    }
                    ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
                    buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
                }
                fmt++;
                continue;
#if !(NGX_WIN32)
            case 'r':
                i64 = (int64_t) va_arg(args, rlim_t);
                sign = 1;
                break;
#endif
            case 'p':
                ui64 = (uintptr_t) va_arg(args, void *);
                hex = 2;
                sign = 0;
                zero = '0';
                width = NGX_PTR_SIZE * 2;
                break;
            case 'c':
                d = va_arg(args, int);
                *buf++ = (u_char) (d & 0xff);
                fmt++;
                continue;
            case 'Z':
                *buf++ = '\0';
                fmt++;
                continue;
            case 'N':
#if (NGX_WIN32)
                *buf++ = CR;
#endif
                *buf++ = LF;
                fmt++;
                continue;
            case '%':
                *buf++ = '%';
                fmt++;
                continue;
            default:
                *buf++ = *fmt++;
                continue;
            }
            if (sign) {
                if (i64 < 0) {
                    *buf++ = '-';
                    ui64 = (uint64_t) -i64;
                } else {
                    ui64 = (uint64_t) i64;
                }
            }
            buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);
            fmt++;
        } else {
            *buf++ = *fmt++;
        }
    }
    return buf;
}
['ngx_cycle_t *\nngx_init_cycle(ngx_cycle_t *old_cycle)\n{\n    void                *rv;\n    char               **senv, **env;\n    u_char              *lock_file;\n    ngx_uint_t           i, n;\n    ngx_log_t           *log;\n    ngx_time_t          *tp;\n    ngx_conf_t           conf;\n    ngx_pool_t          *pool;\n    ngx_cycle_t         *cycle, **old;\n    ngx_shm_zone_t      *shm_zone, *oshm_zone;\n    ngx_slab_pool_t     *shpool;\n    ngx_list_part_t     *part, *opart;\n    ngx_open_file_t     *file;\n    ngx_listening_t     *ls, *nls;\n    ngx_core_conf_t     *ccf, *old_ccf;\n    ngx_core_module_t   *module;\n    char                 hostname[NGX_MAXHOSTNAMELEN];\n    ngx_timezone_update();\n    tp = ngx_timeofday();\n    tp->sec = 0;\n    ngx_time_update(0, 0);\n    log = old_cycle->log;\n    pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log);\n    if (pool == NULL) {\n        return NULL;\n    }\n    pool->log = log;\n    cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t));\n    if (cycle == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    cycle->pool = pool;\n    cycle->log = log;\n    cycle->old_cycle = old_cycle;\n    cycle->root.len = sizeof(NGX_PREFIX) - 1;\n    cycle->root.data = (u_char *) NGX_PREFIX;\n    cycle->conf_file.len = old_cycle->conf_file.len;\n    cycle->conf_file.data = ngx_pnalloc(pool, old_cycle->conf_file.len + 1);\n    if (cycle->conf_file.data == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    ngx_cpystrn(cycle->conf_file.data, old_cycle->conf_file.data,\n                old_cycle->conf_file.len + 1);\n    cycle->conf_param.len = old_cycle->conf_param.len;\n    cycle->conf_param.data = ngx_pnalloc(pool, old_cycle->conf_param.len);\n    if (cycle->conf_param.data == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    ngx_memcpy(cycle->conf_param.data, old_cycle->conf_param.data,\n               old_cycle->conf_param.len);\n    n = old_cycle->pathes.nelts ? old_cycle->pathes.nelts : 10;\n    cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *));\n    if (cycle->pathes.elts == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    cycle->pathes.nelts = 0;\n    cycle->pathes.size = sizeof(ngx_path_t *);\n    cycle->pathes.nalloc = n;\n    cycle->pathes.pool = pool;\n    if (old_cycle->open_files.part.nelts) {\n        n = old_cycle->open_files.part.nelts;\n        for (part = old_cycle->open_files.part.next; part; part = part->next) {\n            n += part->nelts;\n        }\n    } else {\n        n = 20;\n    }\n    if (ngx_list_init(&cycle->open_files, pool, n, sizeof(ngx_open_file_t))\n        != NGX_OK)\n    {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    if (old_cycle->shared_memory.part.nelts) {\n        n = old_cycle->shared_memory.part.nelts;\n        for (part = old_cycle->shared_memory.part.next; part; part = part->next)\n        {\n            n += part->nelts;\n        }\n    } else {\n        n = 1;\n    }\n    if (ngx_list_init(&cycle->shared_memory, pool, n, sizeof(ngx_shm_zone_t))\n        != NGX_OK)\n    {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    cycle->new_log = ngx_log_create_errlog(cycle, NULL);\n    if (cycle->new_log == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    cycle->new_log->file->name = error_log;\n    n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10;\n    cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));\n    if (cycle->listening.elts == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    cycle->listening.nelts = 0;\n    cycle->listening.size = sizeof(ngx_listening_t);\n    cycle->listening.nalloc = n;\n    cycle->listening.pool = pool;\n    cycle->conf_ctx = ngx_pcalloc(pool, ngx_max_module * sizeof(void *));\n    if (cycle->conf_ctx == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    if (gethostname(hostname, NGX_MAXHOSTNAMELEN) == -1) {\n        ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "gethostname() failed");\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    hostname[NGX_MAXHOSTNAMELEN - 1] = \'\\0\';\n    cycle->hostname.len = ngx_strlen(hostname);\n    cycle->hostname.data = ngx_pnalloc(pool, cycle->hostname.len);\n    if (cycle->hostname.data == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    ngx_memcpy(cycle->hostname.data, hostname, cycle->hostname.len);\n    for (i = 0; ngx_modules[i]; i++) {\n        if (ngx_modules[i]->type != NGX_CORE_MODULE) {\n            continue;\n        }\n        module = ngx_modules[i]->ctx;\n        if (module->create_conf) {\n            rv = module->create_conf(cycle);\n            if (rv == NGX_CONF_ERROR) {\n                ngx_destroy_pool(pool);\n                return NULL;\n            }\n            cycle->conf_ctx[ngx_modules[i]->index] = rv;\n        }\n    }\n    senv = environ;\n    ngx_memzero(&conf, sizeof(ngx_conf_t));\n    conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t));\n    if (conf.args == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    conf.temp_pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log);\n    if (conf.temp_pool == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n    conf.ctx = cycle->conf_ctx;\n    conf.cycle = cycle;\n    conf.pool = pool;\n    conf.log = log;\n    conf.module_type = NGX_CORE_MODULE;\n    conf.cmd_type = NGX_MAIN_CONF;\n#if 0\n    log->log_level = NGX_LOG_DEBUG_ALL;\n#endif\n    if (ngx_conf_param(&conf) != NGX_CONF_OK) {\n        ngx_destroy_cycle_pools(&conf);\n        return NULL;\n    }\n    if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) {\n        ngx_destroy_cycle_pools(&conf);\n        return NULL;\n    }\n    if (ngx_test_config) {\n        ngx_log_error(NGX_LOG_INFO, log, 0,\n                      "the configuration file %s syntax is ok",\n                      cycle->conf_file.data);\n    }\n    for (i = 0; ngx_modules[i]; i++) {\n        if (ngx_modules[i]->type != NGX_CORE_MODULE) {\n            continue;\n        }\n        module = ngx_modules[i]->ctx;\n        if (module->init_conf) {\n            if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index])\n                == NGX_CONF_ERROR)\n            {\n                ngx_destroy_cycle_pools(&conf);\n                return NULL;\n            }\n        }\n    }\n    ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);\n#if !(NGX_WIN32)\n    if (ngx_test_config) {\n        if (ngx_create_pidfile(&ccf->pid, log) != NGX_OK) {\n            goto failed;\n        }\n    } else if (!ngx_is_init_cycle(old_cycle)) {\n        old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,\n                                                   ngx_core_module);\n        if (ccf->pid.len != old_ccf->pid.len\n            || ngx_strcmp(ccf->pid.data, old_ccf->pid.data) != 0)\n        {\n            if (ngx_create_pidfile(&ccf->pid, log) != NGX_OK) {\n                goto failed;\n            }\n            ngx_delete_pidfile(old_cycle);\n        }\n    }\n#endif\n    if (ngx_test_lockfile(cycle->lock_file.data, log) != NGX_OK) {\n        goto failed;\n    }\n    if (ngx_create_pathes(cycle, ccf->user) != NGX_OK) {\n        goto failed;\n    }\n    part = &cycle->open_files.part;\n    file = part->elts;\n    for (i = 0;   ; i++) {\n        if (i >= part->nelts) {\n            if (part->next == NULL) {\n                break;\n            }\n            part = part->next;\n            file = part->elts;\n            i = 0;\n        }\n        if (file[i].name.data == NULL) {\n            continue;\n        }\n        file[i].fd = ngx_open_file(file[i].name.data,\n                                   NGX_FILE_APPEND,\n                                   NGX_FILE_CREATE_OR_OPEN,\n                                   NGX_FILE_DEFAULT_ACCESS);\n        ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,\n                       "log: %p %d \\"%s\\"",\n                       &file[i], file[i].fd, file[i].name.data);\n        if (file[i].fd == NGX_INVALID_FILE) {\n            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,\n                          ngx_open_file_n " \\"%s\\" failed",\n                          file[i].name.data);\n            goto failed;\n        }\n#if !(NGX_WIN32)\n        if (fcntl(file[i].fd, F_SETFD, FD_CLOEXEC) == -1) {\n            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,\n                          "fcntl(FD_CLOEXEC) \\"%s\\" failed",\n                          file[i].name.data);\n            goto failed;\n        }\n#endif\n    }\n    cycle->log = cycle->new_log;\n    pool->log = cycle->new_log;\n    if (cycle->log->log_level == 0) {\n        cycle->log->log_level = NGX_LOG_ERR;\n    }\n    part = &cycle->shared_memory.part;\n    shm_zone = part->elts;\n    for (i = 0;   ; i++) {\n        if (i >= part->nelts) {\n            if (part->next == NULL) {\n                break;\n            }\n            part = part->next;\n            shm_zone = part->elts;\n            i = 0;\n        }\n        if (shm_zone[i].shm.size == 0) {\n            ngx_log_error(NGX_LOG_EMERG, log, 0,\n                          "zero size shared memory zone \\"%V\\"",\n                          &shm_zone[i].name);\n            goto failed;\n        }\n        if (shm_zone[i].init == NULL) {\n            continue;\n        }\n        shm_zone[i].shm.log = cycle->log;\n        opart = &old_cycle->shared_memory.part;\n        oshm_zone = opart->elts;\n        for (n = 0;   ; n++) {\n            if (n >= opart->nelts) {\n                if (opart->next == NULL) {\n                    break;\n                }\n                opart = opart->next;\n                oshm_zone = opart->elts;\n                n = 0;\n            }\n            if (shm_zone[i].name.len != oshm_zone[n].name.len) {\n                continue;\n            }\n            if (ngx_strncmp(shm_zone[i].name.data, oshm_zone[n].name.data,\n                            shm_zone[i].name.len)\n                != 0)\n            {\n                continue;\n            }\n            if (shm_zone[i].shm.size == oshm_zone[n].shm.size) {\n                shm_zone[i].shm.addr = oshm_zone[n].shm.addr;\n                if (shm_zone[i].init(&shm_zone[i], oshm_zone[n].data)\n                    != NGX_OK)\n                {\n                    goto failed;\n                }\n                goto shm_zone_found;\n            }\n            ngx_shm_free(&oshm_zone[n].shm);\n            break;\n        }\n        if (ngx_shm_alloc(&shm_zone[i].shm) != NGX_OK) {\n            goto failed;\n        }\n        shpool = (ngx_slab_pool_t *) shm_zone[i].shm.addr;\n        shpool->end = shm_zone[i].shm.addr + shm_zone[i].shm.size;\n        shpool->min_shift = 3;\n#if (NGX_HAVE_ATOMIC_OPS)\n        lock_file = NULL;\n#else\n        lock_file = ngx_pnalloc(cycle->pool,\n                                cycle->lock_file.len + shm_zone[i].name.len);\n        if (lock_file == NULL) {\n            goto failed;\n        }\n        (void) ngx_cpystrn(ngx_cpymem(lock_file, cycle->lock_file.data,\n                                      cycle->lock_file.len),\n                           shm_zone[i].name.data, shm_zone[i].name.len + 1);\n#endif\n        if (ngx_shmtx_create(&shpool->mutex, (void *) &shpool->lock, lock_file)\n            != NGX_OK)\n        {\n            goto failed;\n        }\n        ngx_slab_init(shpool);\n        if (shm_zone[i].init(&shm_zone[i], NULL) != NGX_OK) {\n            goto failed;\n        }\n    shm_zone_found:\n        continue;\n    }\n    if (old_cycle->listening.nelts) {\n        ls = old_cycle->listening.elts;\n        for (i = 0; i < old_cycle->listening.nelts; i++) {\n            ls[i].remain = 0;\n        }\n        nls = cycle->listening.elts;\n        for (n = 0; n < cycle->listening.nelts; n++) {\n            for (i = 0; i < old_cycle->listening.nelts; i++) {\n                if (ls[i].ignore) {\n                    continue;\n                }\n                if (ngx_cmp_sockaddr(nls[n].sockaddr, ls[i].sockaddr) == NGX_OK)\n                {\n                    nls[n].fd = ls[i].fd;\n                    nls[n].previous = &ls[i];\n                    ls[i].remain = 1;\n                    if (ls[n].backlog != nls[i].backlog) {\n                        nls[n].listen = 1;\n                    }\n#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)\n                    nls[n].deferred_accept = ls[i].deferred_accept;\n                    if (ls[i].accept_filter && nls[n].accept_filter) {\n                        if (ngx_strcmp(ls[i].accept_filter,\n                                       nls[n].accept_filter)\n                            != 0)\n                        {\n                            nls[n].delete_deferred = 1;\n                            nls[n].add_deferred = 1;\n                        }\n                    } else if (ls[i].accept_filter) {\n                        nls[n].delete_deferred = 1;\n                    } else if (nls[n].accept_filter) {\n                        nls[n].add_deferred = 1;\n                    }\n#endif\n#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)\n                    if (ls[n].deferred_accept && !nls[n].deferred_accept) {\n                        nls[n].delete_deferred = 1;\n                    } else if (ls[i].deferred_accept != nls[n].deferred_accept)\n                    {\n                        nls[n].add_deferred = 1;\n                    }\n#endif\n                    break;\n                }\n            }\n            if (nls[n].fd == -1) {\n                nls[n].open = 1;\n            }\n        }\n    } else {\n        ls = cycle->listening.elts;\n        for (i = 0; i < cycle->listening.nelts; i++) {\n            ls[i].open = 1;\n#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)\n            if (ls[i].accept_filter) {\n                ls[i].add_deferred = 1;\n            }\n#endif\n#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)\n            if (ls[i].deferred_accept) {\n                ls[i].add_deferred = 1;\n            }\n#endif\n        }\n    }\n    if (ngx_open_listening_sockets(cycle) != NGX_OK) {\n        goto failed;\n    }\n    if (!ngx_test_config) {\n        ngx_configure_listening_socket(cycle);\n    }\n#if !(NGX_WIN32)\n    if (!ngx_test_config && cycle->log->file->fd != STDERR_FILENO) {\n        ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,\n                       "dup2: %p %d \\"%s\\"",\n                       cycle->log->file,\n                       cycle->log->file->fd, cycle->log->file->name.data);\n        if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) {\n            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,\n                          "dup2(STDERR) failed");\n            exit(1);\n        }\n    }\n#endif\n    pool->log = cycle->log;\n    for (i = 0; ngx_modules[i]; i++) {\n        if (ngx_modules[i]->init_module) {\n            if (ngx_modules[i]->init_module(cycle) != NGX_OK) {\n                exit(1);\n            }\n        }\n    }\n    opart = &old_cycle->shared_memory.part;\n    oshm_zone = opart->elts;\n    for (i = 0;   ; i++) {\n        if (i >= opart->nelts) {\n            if (opart->next == NULL) {\n                goto old_shm_zone_done;\n            }\n            opart = opart->next;\n            oshm_zone = opart->elts;\n            i = 0;\n        }\n        part = &cycle->shared_memory.part;\n        shm_zone = part->elts;\n        for (n = 0;   ; n++) {\n            if (n >= part->nelts) {\n                if (part->next == NULL) {\n                    break;\n                }\n                part = part->next;\n                shm_zone = part->elts;\n                n = 0;\n            }\n            if (oshm_zone[i].name.len == shm_zone[n].name.len\n                && ngx_strncmp(oshm_zone[i].name.data,\n                               shm_zone[n].name.data,\n                               oshm_zone[i].name.len)\n                == 0)\n            {\n                goto live_shm_zone;\n            }\n        }\n        ngx_shm_free(&oshm_zone[i].shm);\n    live_shm_zone:\n        continue;\n    }\nold_shm_zone_done:\n    ls = old_cycle->listening.elts;\n    for (i = 0; i < old_cycle->listening.nelts; i++) {\n        if (ls[i].remain) {\n            continue;\n        }\n        if (ngx_close_socket(ls[i].fd) == -1) {\n            ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,\n                          ngx_close_socket_n " listening socket on %V failed",\n                          &ls[i].addr_text);\n        }\n    }\n    part = &old_cycle->open_files.part;\n    file = part->elts;\n    for (i = 0;   ; i++) {\n        if (i >= part->nelts) {\n            if (part->next == NULL) {\n                break;\n            }\n            part = part->next;\n            file = part->elts;\n            i = 0;\n        }\n        if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) {\n            continue;\n        }\n        if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {\n            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,\n                          ngx_close_file_n " \\"%s\\" failed",\n                          file[i].name.data);\n        }\n    }\n    ngx_destroy_pool(conf.temp_pool);\n    if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {\n        env = environ;\n        environ = senv;\n        ngx_destroy_pool(old_cycle->pool);\n        cycle->old_cycle = NULL;\n        environ = env;\n        return cycle;\n    }\n    if (ngx_temp_pool == NULL) {\n        ngx_temp_pool = ngx_create_pool(128, cycle->log);\n        if (ngx_temp_pool == NULL) {\n            ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,\n                          "can not create ngx_temp_pool");\n            exit(1);\n        }\n        n = 10;\n        ngx_old_cycles.elts = ngx_pcalloc(ngx_temp_pool,\n                                          n * sizeof(ngx_cycle_t *));\n        if (ngx_old_cycles.elts == NULL) {\n            exit(1);\n        }\n        ngx_old_cycles.nelts = 0;\n        ngx_old_cycles.size = sizeof(ngx_cycle_t *);\n        ngx_old_cycles.nalloc = n;\n        ngx_old_cycles.pool = ngx_temp_pool;\n        ngx_cleaner_event.handler = ngx_clean_old_cycles;\n        ngx_cleaner_event.log = cycle->log;\n        ngx_cleaner_event.data = &dumb;\n        dumb.fd = (ngx_socket_t) -1;\n    }\n    ngx_temp_pool->log = cycle->log;\n    old = ngx_array_push(&ngx_old_cycles);\n    if (old == NULL) {\n        exit(1);\n    }\n    *old = old_cycle;\n    if (!ngx_cleaner_event.timer_set) {\n        ngx_add_timer(&ngx_cleaner_event, 30000);\n        ngx_cleaner_event.timer_set = 1;\n    }\n    return cycle;\nfailed:\n    if (!ngx_is_init_cycle(old_cycle)) {\n        old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,\n                                                   ngx_core_module);\n        if (old_ccf->environment) {\n            environ = old_ccf->environment;\n        }\n    }\n    part = &cycle->open_files.part;\n    file = part->elts;\n    for (i = 0;   ; i++) {\n        if (i >= part->nelts) {\n            if (part->next == NULL) {\n                break;\n            }\n            part = part->next;\n            file = part->elts;\n            i = 0;\n        }\n        if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) {\n            continue;\n        }\n        if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {\n            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,\n                          ngx_close_file_n " \\"%s\\" failed",\n                          file[i].name.data);\n        }\n    }\n    if (ngx_test_config) {\n        ngx_destroy_cycle_pools(&conf);\n        return NULL;\n    }\n    ls = cycle->listening.elts;\n    for (i = 0; i < cycle->listening.nelts; i++) {\n        if (ls[i].fd == -1 || !ls[i].open) {\n            continue;\n        }\n        if (ngx_close_socket(ls[i].fd) == -1) {\n            ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,\n                          ngx_close_socket_n " %V failed",\n                          &ls[i].addr_text);\n        }\n    }\n    ngx_destroy_cycle_pools(&conf);\n    return NULL;\n}', 'void\nngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,\n    const char *fmt, ...)\n#else\nvoid\nngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,\n    const char *fmt, va_list args)\n#endif\n{\n#if (NGX_HAVE_VARIADIC_MACROS)\n    va_list  args;\n#endif\n    u_char   errstr[NGX_MAX_ERROR_STR], *p, *last;\n    if (log->file->fd == NGX_INVALID_FILE) {\n        return;\n    }\n    last = errstr + NGX_MAX_ERROR_STR;\n    ngx_memcpy(errstr, ngx_cached_err_log_time.data,\n               ngx_cached_err_log_time.len);\n    p = errstr + ngx_cached_err_log_time.len;\n    p = ngx_snprintf(p, last - p, " [%s] ", err_levels[level]);\n    p = ngx_snprintf(p, last - p, "%P#" NGX_TID_T_FMT ": ",\n                    ngx_log_pid, ngx_log_tid);\n    if (log->connection) {\n        p = ngx_snprintf(p, last - p, "*%uA ", log->connection);\n    }\n#if (NGX_HAVE_VARIADIC_MACROS)\n    va_start(args, fmt);\n    p = ngx_vsnprintf(p, last - p, fmt, args);\n    va_end(args);\n#else\n    p = ngx_vsnprintf(p, last - p, fmt, args);\n#endif\n    if (err) {\n        if (p > last - 50) {\n            p = last - 50;\n            *p++ = \'.\';\n            *p++ = \'.\';\n            *p++ = \'.\';\n        }\n#if (NGX_WIN32)\n        p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000)\n                                           ? " (%d: " : " (%Xd: ", err);\n#else\n        p = ngx_snprintf(p, last - p, " (%d: ", err);\n#endif\n        p = ngx_strerror_r(err, p, last - p);\n        if (p < last) {\n            *p++ = \')\';\n        }\n    }\n    if (level != NGX_LOG_DEBUG && log->handler) {\n        p = log->handler(log, p, last - p);\n    }\n    if (p > last - NGX_LINEFEED_SIZE) {\n        p = last - NGX_LINEFEED_SIZE;\n    }\n    ngx_linefeed(p);\n    (void) ngx_write_fd(log->file->fd, errstr, p - errstr);\n}', 'u_char * ngx_cdecl\nngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)\n{\n    u_char   *p;\n    va_list   args;\n    va_start(args, fmt);\n    p = ngx_vsnprintf(buf, max, fmt, args);\n    va_end(args);\n    return p;\n}', "u_char *\nngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)\n{\n    u_char                *p, zero, *last;\n    int                    d;\n    float                  f, scale;\n    size_t                 len, slen;\n    int64_t                i64;\n    uint64_t               ui64;\n    ngx_msec_t             ms;\n    ngx_uint_t             width, sign, hex, max_width, frac_width, i;\n    ngx_str_t             *v;\n    ngx_variable_value_t  *vv;\n    if (max == 0) {\n        return buf;\n    }\n    last = buf + max;\n    while (*fmt && buf < last) {\n        if (*fmt == '%') {\n            i64 = 0;\n            ui64 = 0;\n            zero = (u_char) ((*++fmt == '0') ? '0' : ' ');\n            width = 0;\n            sign = 1;\n            hex = 0;\n            max_width = 0;\n            frac_width = 0;\n            slen = (size_t) -1;\n            while (*fmt >= '0' && *fmt <= '9') {\n                width = width * 10 + *fmt++ - '0';\n            }\n            for ( ;; ) {\n                switch (*fmt) {\n                case 'u':\n                    sign = 0;\n                    fmt++;\n                    continue;\n                case 'm':\n                    max_width = 1;\n                    fmt++;\n                    continue;\n                case 'X':\n                    hex = 2;\n                    sign = 0;\n                    fmt++;\n                    continue;\n                case 'x':\n                    hex = 1;\n                    sign = 0;\n                    fmt++;\n                    continue;\n                case '.':\n                    fmt++;\n                    while (*fmt >= '0' && *fmt <= '9') {\n                        frac_width = frac_width * 10 + *fmt++ - '0';\n                    }\n                    break;\n                case '*':\n                    slen = va_arg(args, size_t);\n                    fmt++;\n                    continue;\n                default:\n                    break;\n                }\n                break;\n            }\n            switch (*fmt) {\n            case 'V':\n                v = va_arg(args, ngx_str_t *);\n                len = v->len;\n                len = (buf + len < last) ? len : (size_t) (last - buf);\n                buf = ngx_cpymem(buf, v->data, len);\n                fmt++;\n                continue;\n            case 'v':\n                vv = va_arg(args, ngx_variable_value_t *);\n                len = vv->len;\n                len = (buf + len < last) ? len : (size_t) (last - buf);\n                buf = ngx_cpymem(buf, vv->data, len);\n                fmt++;\n                continue;\n            case 's':\n                p = va_arg(args, u_char *);\n                if (slen == (size_t) -1) {\n                    while (*p && buf < last) {\n                        *buf++ = *p++;\n                    }\n                } else {\n                    len = (buf + slen < last) ? slen : (size_t) (last - buf);\n                    buf = ngx_cpymem(buf, p, len);\n                }\n                fmt++;\n                continue;\n            case 'O':\n                i64 = (int64_t) va_arg(args, off_t);\n                sign = 1;\n                break;\n            case 'P':\n                i64 = (int64_t) va_arg(args, ngx_pid_t);\n                sign = 1;\n                break;\n            case 'T':\n                i64 = (int64_t) va_arg(args, time_t);\n                sign = 1;\n                break;\n            case 'M':\n                ms = (ngx_msec_t) va_arg(args, ngx_msec_t);\n                if ((ngx_msec_int_t) ms == -1) {\n                    sign = 1;\n                    i64 = -1;\n                } else {\n                    sign = 0;\n                    ui64 = (uint64_t) ms;\n                }\n                break;\n            case 'z':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, ssize_t);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, size_t);\n                }\n                break;\n            case 'i':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, ngx_int_t);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, ngx_uint_t);\n                }\n                if (max_width) {\n                    width = NGX_INT_T_LEN;\n                }\n                break;\n            case 'd':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, int);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, u_int);\n                }\n                break;\n            case 'l':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, long);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, u_long);\n                }\n                break;\n            case 'D':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, int32_t);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, uint32_t);\n                }\n                break;\n            case 'L':\n                if (sign) {\n                    i64 = va_arg(args, int64_t);\n                } else {\n                    ui64 = va_arg(args, uint64_t);\n                }\n                break;\n            case 'A':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, ngx_atomic_int_t);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);\n                }\n                if (max_width) {\n                    width = NGX_ATOMIC_T_LEN;\n                }\n                break;\n            case 'f':\n                f = (float) va_arg(args, double);\n                if (f < 0) {\n                    *buf++ = '-';\n                    f = -f;\n                }\n                ui64 = (int64_t) f;\n                buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);\n                if (frac_width) {\n                    if (buf < last) {\n                        *buf++ = '.';\n                    }\n                    scale = 1.0;\n                    for (i = 0; i < frac_width; i++) {\n                        scale *= 10.0;\n                    }\n                    ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);\n                    buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);\n                }\n                fmt++;\n                continue;\n#if !(NGX_WIN32)\n            case 'r':\n                i64 = (int64_t) va_arg(args, rlim_t);\n                sign = 1;\n                break;\n#endif\n            case 'p':\n                ui64 = (uintptr_t) va_arg(args, void *);\n                hex = 2;\n                sign = 0;\n                zero = '0';\n                width = NGX_PTR_SIZE * 2;\n                break;\n            case 'c':\n                d = va_arg(args, int);\n                *buf++ = (u_char) (d & 0xff);\n                fmt++;\n                continue;\n            case 'Z':\n                *buf++ = '\\0';\n                fmt++;\n                continue;\n            case 'N':\n#if (NGX_WIN32)\n                *buf++ = CR;\n#endif\n                *buf++ = LF;\n                fmt++;\n                continue;\n            case '%':\n                *buf++ = '%';\n                fmt++;\n                continue;\n            default:\n                *buf++ = *fmt++;\n                continue;\n            }\n            if (sign) {\n                if (i64 < 0) {\n                    *buf++ = '-';\n                    ui64 = (uint64_t) -i64;\n                } else {\n                    ui64 = (uint64_t) i64;\n                }\n            }\n            buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);\n            fmt++;\n        } else {\n            *buf++ = *fmt++;\n        }\n    }\n    return buf;\n}"]