|
rpm-build |
3ee90c |
/*
|
|
rpm-build |
3ee90c |
* Copyright (C) 2001 Alan Robertson <alanr@unix.sh>
|
|
rpm-build |
3ee90c |
* This software licensed under the GNU LGPL.
|
|
rpm-build |
3ee90c |
*
|
|
rpm-build |
3ee90c |
*
|
|
rpm-build |
3ee90c |
* This library is free software; you can redistribute it and/or
|
|
rpm-build |
3ee90c |
* modify it under the terms of the GNU Lesser General Public
|
|
rpm-build |
3ee90c |
* License as published by the Free Software Foundation; either
|
|
rpm-build |
3ee90c |
* version 2.1 of the License, or (at your option) any later version.
|
|
rpm-build |
3ee90c |
*
|
|
rpm-build |
3ee90c |
* This library is distributed in the hope that it will be useful,
|
|
rpm-build |
3ee90c |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
rpm-build |
3ee90c |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
rpm-build |
3ee90c |
* Lesser General Public License for more details.
|
|
rpm-build |
3ee90c |
*
|
|
rpm-build |
3ee90c |
* You should have received a copy of the GNU Lesser General Public
|
|
rpm-build |
3ee90c |
* License along with this library; if not, write to the Free Software
|
|
rpm-build |
3ee90c |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
rpm-build |
3ee90c |
*
|
|
rpm-build |
3ee90c |
*/
|
|
rpm-build |
3ee90c |
#include <crm_internal.h>
|
|
rpm-build |
3ee90c |
#include <stdlib.h>
|
|
rpm-build |
3ee90c |
#include <stdio.h>
|
|
rpm-build |
3ee90c |
|
|
rpm-build |
3ee90c |
/*
|
|
rpm-build |
3ee90c |
* Small replacement function for setenv()
|
|
rpm-build |
3ee90c |
*/
|
|
rpm-build |
3ee90c |
int
|
|
rpm-build |
3ee90c |
setenv(const char *name, const char *value, int why)
|
|
rpm-build |
3ee90c |
{
|
|
rpm-build |
3ee90c |
int rc = -1;
|
|
rpm-build |
3ee90c |
|
|
rpm-build |
3ee90c |
if (name && value) {
|
|
rpm-build |
3ee90c |
char *envp = crm_strdup_printf("%s=%s", name, value);
|
|
rpm-build |
3ee90c |
|
|
rpm-build |
3ee90c |
/*
|
|
rpm-build |
3ee90c |
* Cannot free envp (!)
|
|
rpm-build |
3ee90c |
* Unfortunately, the putenv API guarantees memory leaks when
|
|
rpm-build |
3ee90c |
* changing environment variables repeatedly... :-(
|
|
rpm-build |
3ee90c |
*/
|
|
rpm-build |
3ee90c |
rc = putenv(envp);
|
|
rpm-build |
3ee90c |
}
|
|
rpm-build |
3ee90c |
return (rc);
|
|
rpm-build |
3ee90c |
}
|