From c51c83b1d507bccc2ca30daecb7022feb64c2765 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 25 Feb 2020 09:59:21 +0100 Subject: [PATCH] Revert "fix crash in PINI: use local db_field_log" This reverts commit a590151accb1d187562c515a48e013244dd98a45. Conflicts: modules/database/src/ioc/db/dbDbLink.c --- modules/database/src/ioc/db/dbDbLink.c | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/modules/database/src/ioc/db/dbDbLink.c b/modules/database/src/ioc/db/dbDbLink.c index c8452fd86..1a6fa6e44 100644 --- a/modules/database/src/ioc/db/dbDbLink.c +++ b/modules/database/src/ioc/db/dbDbLink.c @@ -180,21 +180,28 @@ static long dbDbGetValue(struct link *plink, short dbrType, void *pbuffer, /* If filters are involved in a read, create field log and run filters */ if (ellCount(&chan->filters)) { + db_field_log *pfl; long options = 0; - db_field_log fl = {}; - fl.ctx = dbfl_context_read; - fl.type = dbfl_type_rec; /* For the moment, empty arrays are not supported by EPICS */ - if (dbChannelFinalElements(chan) > 0) + if (dbChannelFinalElements(chan) <= 0) { - dbChannelRunPreChain(chan, &fl); - dbChannelRunPostChain(chan, &fl); - status = dbChannelGet(chan, dbrType, pbuffer, &options, pnRequest, &fl); - if (!status && pnRequest && *pnRequest <= 0) - status = S_db_badField; - } else { + /* empty array request */ status = S_db_badField; + } else { + pfl = db_create_read_log(chan); + if (!pfl) { + status = S_db_noMemory; + } else { + pfl = dbChannelRunPreChain(chan, pfl); + pfl = dbChannelRunPostChain(chan, pfl); + status = dbChannelGet(chan, dbrType, pbuffer, &options, pnRequest, pfl); + db_delete_field_log(pfl); + if (!status && pnRequest && *pnRequest <= 0) { + /* empty array result */ + status = S_db_badField; + } + } } if (status) { recGblSetSevr(precord, LINK_ALARM, UDF_ALARM);