summaryrefslogtreecommitdiffstats
path: root/compat/setenv.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2010-06-05 18:20:48 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2010-06-05 18:20:48 +0000
commit89eb95265a8acf42f17f7f93b1b5206a20f842a9 (patch)
tree3de722bd5363bfcdbe36083ace62700e91cfede9 /compat/setenv.c
parentd98efa53781443fd1a6b0797606632f9ce106c35 (diff)
Must allocate for putenv.
Diffstat (limited to 'compat/setenv.c')
-rw-r--r--compat/setenv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/compat/setenv.c b/compat/setenv.c
index d7ff4d59..79461f04 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -1,4 +1,4 @@
-/* $Id: setenv.c,v 1.1 2010-05-19 21:31:39 nicm Exp $ */
+/* $Id: setenv.c,v 1.2 2010-06-05 18:20:48 nicm Exp $ */
/*
* Copyright (c) 2010 Dagobert Michelsen
@@ -25,10 +25,10 @@
int
setenv(const char *name, const char *value, unused int overwrite)
{
- char buf[1024];
+ char *newval;
- snprintf(buf, sizeof(buf), "%s=%s", name, value);
- return (putenv(buf));
+ xasprintf(&newval, "%s=%s", name, value);
+ return (putenv(newval));
}
int