From 12cfd418d62e066e1ea08ef2af6603d27168999d Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Mon, 6 Jul 2020 14:58:00 +0200 Subject: [PATCH] fix dbPut to set target to INVALID/LINK alarm when writing empty arrays into scalars --- modules/database/src/ioc/db/dbAccess.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/modules/database/src/ioc/db/dbAccess.c b/modules/database/src/ioc/db/dbAccess.c index 112b6152b..4fbfa966e 100644 --- a/modules/database/src/ioc/db/dbAccess.c +++ b/modules/database/src/ioc/db/dbAccess.c @@ -1334,25 +1334,21 @@ long dbPut(DBADDR *paddr, short dbrType, status = prset->get_array_info(paddr, &dummy, &offset); /* paddr->pfield may be modified */ if (status) goto done; - } else - offset = 0; - - if (no_elements <= 1) { - status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer, - paddr->pfield, paddr); - nRequest = 1; - } else { if (no_elements < nRequest) nRequest = no_elements; status = dbPutConvertRoutine[dbrType][field_type](paddr, pbuffer, nRequest, no_elements, offset); - } - - /* update array info */ - if (!status && - paddr->pfldDes->special == SPC_DBADDR && - prset && prset->put_array_info) { - status = prset->put_array_info(paddr, nRequest); + /* update array info */ + if (!status) + status = prset->put_array_info(paddr, nRequest); + } else { + if (nRequest < 1) { + recGblSetSevr(precord, LINK_ALARM, INVALID_ALARM); + } else { + status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer, + paddr->pfield, paddr); + nRequest = 1; + } } /* Always do special processing if needed */