diff options
author | Max Kellermann <max@duempel.org> | 2008-12-29 17:37:40 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-12-29 17:37:40 +0100 |
commit | 274b919966c8db5031b1f0c92d0efcd372892e42 (patch) | |
tree | f36b0be9ff05071cd4d9dd3c8796bf43840d885a | |
parent | 6517126204f8eef363a65868ab97473916bd167e (diff) | |
download | mpd-274b919966c8db5031b1f0c92d0efcd372892e42.tar.gz mpd-274b919966c8db5031b1f0c92d0efcd372892e42.tar.xz mpd-274b919966c8db5031b1f0c92d0efcd372892e42.zip |
main: use g_setenv() instead of setenv()
Removed the fallback setenv() implementation for solaris.
Diffstat (limited to '')
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/main.c | 43 |
2 files changed, 1 insertions, 43 deletions
diff --git a/configure.ac b/configure.ac index f9a666d41..2ba64c678 100644 --- a/configure.ac +++ b/configure.ac @@ -360,7 +360,6 @@ AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",) AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",) AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",) -AC_CHECK_FUNCS(setenv) # Check for pkg-config before using it PKG_PROG_PKG_CONFIG diff --git a/src/main.c b/src/main.c index 4a43d7899..6d7791b1b 100644 --- a/src/main.c +++ b/src/main.c @@ -71,47 +71,6 @@ #include <locale.h> #endif -/* - * from git-1.3.0, needed for solaris - */ -#ifndef HAVE_SETENV -static int setenv(const char *name, const char *value, int replace) -{ - int out; - size_t namelen, valuelen; - char *envstr; - - if (!name || !value) - return -1; - if (!replace) { - char *oldval = NULL; - oldval = getenv(name); - if (oldval) - return 0; - } - - namelen = strlen(name); - valuelen = strlen(value); - envstr = xmalloc((namelen + valuelen + 2)); - if (!envstr) - return -1; - - memcpy(envstr, name, namelen); - envstr[namelen] = '='; - memcpy(envstr + namelen + 1, value, valuelen); - envstr[namelen + valuelen + 1] = 0; - - out = putenv(envstr); - /* putenv(3) makes the argument string part of the environment, - * and changing that string modifies the environment --- which - * means we do not own that storage anymore. Do not free - * envstr. - */ - - return out; -} -#endif /* HAVE_SETENV */ - static void changeToUser(void) { ConfigParam *param = getConfigParam(CONF_USER); @@ -148,7 +107,7 @@ static void changeToUser(void) /* this is needed by libs such as arts */ if (userpwd->pw_dir) { - setenv("HOME", userpwd->pw_dir, 1); + g_setenv("HOME", userpwd->pw_dir, true); } } } |