diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-28 20:22:05 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-28 20:22:05 +0000 |
commit | e9a1b3231c24b7eafda60b5cac11b08efa3e02ce (patch) | |
tree | 727f454640b04506b483f07db320b2e509b12762 /strcompat.c | |
parent | eedd93f836609119935a16fd59499e4573fa843e (diff) |
backport astmm + sparch fixes from the trunk
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@15743 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'strcompat.c')
-rw-r--r-- | strcompat.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/strcompat.c b/strcompat.c index 38615ac5d..233bacc86 100644 --- a/strcompat.c +++ b/strcompat.c @@ -33,21 +33,18 @@ char* strsep(char** str, const char* delims) int setenv(const char *name, const char *value, int overwrite) { unsigned char *buf; - int buflen, ret; + int buflen; buflen = strlen(name) + strlen(value) + 2; - if ((buf = malloc(buflen)) == NULL) + if (!(buf = alloca(buflen))) return -1; if (!overwrite && getenv(name)) return 0; snprintf(buf, buflen, "%s=%s", name, value); - ret = putenv(buf); - free(buf); - - return ret; + return putenv(buf); } int unsetenv(const char *name) |