From 9a1b6b995ea16de6b7c8202ca963896802e90d1c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 26 Aug 2011 16:33:59 -0700 Subject: [PATCH] macEnv avoid cantProceed --- src/libCom/macLib/macEnv.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/libCom/macLib/macEnv.c b/src/libCom/macLib/macEnv.c index 766d62473..4a77562c3 100644 --- a/src/libCom/macLib/macEnv.c +++ b/src/libCom/macLib/macEnv.c @@ -13,8 +13,9 @@ #include #include +#include + #define epicsExportSharedSymbols -#include "cantProceed.h" #include "epicsString.h" #include "macLib.h" @@ -27,8 +28,10 @@ macEnvExpand(const char *str) char *dest = NULL; int n; - if (macCreateHandle(&handle, pairs)) - cantProceed("macEnvExpand: macCreateHandle failed."); + if (macCreateHandle(&handle, pairs)){ + errlogMessage("macEnvExpand: macCreateHandle failed."); + return NULL; + } do { destCapacity *= 2; @@ -37,7 +40,10 @@ macEnvExpand(const char *str) * keep the original contents. */ free(dest); - dest = mallocMustSucceed(destCapacity, "macEnvExpand"); + dest = malloc(destCapacity); + if(!dest) + goto done; + n = macExpandString(handle, str, dest, destCapacity); } while (n >= (destCapacity - 1)); @@ -51,7 +57,8 @@ macEnvExpand(const char *str) dest = realloc(dest, n); } +done: if (macDeleteHandle(handle)) - cantProceed("macEnvExpand: macDeleteHandle failed."); + errlogMessage("macEnvExpand: macDeleteHandle failed."); return dest; }