From e7037cc519fdbde6b28e3f67976feaf032414e74 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Mar 2015 11:34:36 -0400 Subject: [PATCH] dbStatic: fix CONSTANT links constantStr==NULL and constantStr=="" have different meanings for recGblInitConstantLink() which is used with DOL. constantStr should remain NULL unless explicitly set by either initial("") or field(..., "") --- src/ioc/dbStatic/dbStaticLib.c | 3 ++- src/ioc/dbStatic/dbStaticRun.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ioc/dbStatic/dbStaticLib.c b/src/ioc/dbStatic/dbStaticLib.c index 45dbda411..b80a295c3 100644 --- a/src/ioc/dbStatic/dbStaticLib.c +++ b/src/ioc/dbStatic/dbStaticLib.c @@ -1915,7 +1915,8 @@ long dbInitRecordLinks(dbRecordType *rtyp, struct dbCommon *prec) plink->type = CONSTANT; switch (plink->type) { - case CONSTANT: plink->value.constantStr = callocMustSucceed(1, 1, "init CONSTANT link"); break; + /* constantStr is allowed to remain NULL if plink->text==NULL */ + case CONSTANT: plink->value.constantStr = NULL; break; case PV_LINK: plink->value.pv_link.pvname = callocMustSucceed(1, 1, "init PV_LINK"); break; case VME_IO: plink->value.vmeio.parm = pNullString; break; case CAMAC_IO: plink->value.camacio.parm = pNullString; break; diff --git a/src/ioc/dbStatic/dbStaticRun.c b/src/ioc/dbStatic/dbStaticRun.c index b6caa1552..2ab477fd6 100644 --- a/src/ioc/dbStatic/dbStaticRun.c +++ b/src/ioc/dbStatic/dbStaticRun.c @@ -270,9 +270,9 @@ long dbAllocRecord(DBENTRY *pdbentry,const char *precordName) plink->type = CONSTANT; if(pflddes->initial) { - plink->value.constantStr = + plink->text = dbCalloc(strlen(pflddes->initial)+1,sizeof(char)); - strcpy(plink->value.constantStr,pflddes->initial); + strcpy(plink->text,pflddes->initial); } } break;