view src/lib/env-util.c @ 7109:e6823d781317 HEAD

Reverted "environment array" changes. It broke overriding imap/pop3 settings from userdb and the performance improvements weren't all that great anyway.
author Timo Sirainen <tss@iki.fi>
date Sat, 05 Jan 2008 01:28:46 +0200
parents c8878d66c4a1
children 8bed019c834d
line wrap: on
line source

/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "env-util.h"

#include <stdlib.h>

static pool_t pool = NULL;

void env_put(const char *env)
{
	if (pool == NULL)
		pool = pool_alloconly_create("Environment", 2048);

	if (putenv(p_strdup(pool, env)) != 0)
		i_fatal("putenv(%s) failed: %m", env);
}

void env_clean(void)
{
	extern char **environ;

	if (environ != NULL)
		*environ = NULL;

	if (pool != NULL)
		pool_unref(&pool);
}