aboutsummaryrefslogtreecommitdiffstats
path: root/strcompat.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-28 20:22:05 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-28 20:22:05 +0000
commite9a1b3231c24b7eafda60b5cac11b08efa3e02ce (patch)
tree727f454640b04506b483f07db320b2e509b12762 /strcompat.c
parenteedd93f836609119935a16fd59499e4573fa843e (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.c9
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)