rv = apr_env_get(&s, "PERL_HASH_SEED_DEBUG", p); if (rv == APR_SUCCESS) { if (s) { int i = atoi(s); if (i == 1) { fprintf(stderr, "\nmod_perl: using init hash seed: %"UVuf"\n", MP_init_hash_seed); } } }
static void modperl_hash_seed_init(apr_pool_t *p) {#ifdef MP_NEED_HASH_SEED_FIXUP    char *s;    /* check if there is a specific hash seed passed via the env var     * and if that's the case -- use it */    apr_status_t rv = apr_env_get(&s, "PERL_HASH_SEED", p);    if (rv == APR_SUCCESS) {        if (s) {            while (isSPACE(*s)) s++;        }        if (s && isDIGIT(*s)) {            MP_init_hash_seed = (UV)Atol(s); // XXX: Atoul()?            MP_init_hash_seed_set = TRUE;        }    }        /* calculate our own random hash seed */    if (!MP_init_hash_seed_set) {        apr_uuid_t *uuid = (apr_uuid_t *)safemalloc(sizeof(apr_uuid_t));        char buf[APR_UUID_FORMATTED_LENGTH + 1];        int i;        apr_initialize();        apr_uuid_get(uuid);        apr_uuid_format(buf, uuid);        /* fprintf(stderr, "UUID: %s\n", buf); */        /* XXX: need a better alg to convert uuid string into a seed */        for (i=0; buf[i]; i++){            MP_init_hash_seed += (UV)(i+1)*(buf[i]+MP_init_hash_seed);        }        MP_init_hash_seed_set = TRUE;    }    /* fprintf(stderr, "GOT SEED: %ld\n", MP_init_hash_seed); */#endif}