From 85936ff34c06bb3b94e9c4ce432c8d4da5d33385 Mon Sep 17 00:00:00 2001 From: Keenan Lang Date: Tue, 2 Sep 2014 16:55:32 -0500 Subject: [PATCH] Darwin's osdEnv.c was updated while I was working on this, changed my updated version to match. --- src/libCom/osi/os/Darwin/osdEnv.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/src/libCom/osi/os/Darwin/osdEnv.c b/src/libCom/osi/os/Darwin/osdEnv.c index be5c63977..7e5415d2f 100644 --- a/src/libCom/osi/os/Darwin/osdEnv.c +++ b/src/libCom/osi/os/Darwin/osdEnv.c @@ -25,44 +25,21 @@ * Starting in Mac OS X 10.5 (Leopard) shared libraries and * bundles don't have direct access to environ (man environ). */ -# include -# define environ (*_NSGetEnviron()) +#include +#define environ (*_NSGetEnviron()) #define epicsExportSharedSymbols #include "epicsStdio.h" -#include -#include #include -#include -#include "epicsFindSymbol.h" #include /* * Set the value of an environment variable - * Leaks memory, but the assumption is that this routine won't be - * called often enough for the leak to be a problem. */ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value) { - char *cp; - iocshEnvClear(name); - - cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet"); - strcpy (cp, name); - strcat (cp, "="); - strcat (cp, value); - if (putenv (cp) < 0) { - errPrintf( - -1L, - __FILE__, - __LINE__, - "Failed to set environment parameter \"%s\" to \"%s\": %s\n", - name, - value, - strerror (errno)); - free (cp); - } + setenv(name, value, 1); } /*