caput doesn't report array overruns

Bug #1747983 reported by Andrew Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
Fix Released
Low
Andrew Johnson

Bug Description

tux% caput -a doubleArray03 10 0 1 2 3 4 5 6 7 8 9
Old : doubleArray03 5 2.50321e-308 0 0 0 0
New : doubleArray03 5 2.50321e-308 0 0 0 0
tux% caget doubleArray03.NELM
doubleArray03.NELM 5
tux% caput -a doubleArray03 5 1 2 3 4 5
Old : doubleArray03 5 2.50321e-308 0 0 0 0
New : doubleArray03 5 1 2 3 4 5

The put fails because the array is smaller than the number of values I'm trying to send, but I get no error message to that effect.

Revision history for this message
Andrew Johnson (anj) wrote :

Suggested fix:

diff --git a/src/ca/client/tools/caput.c b/src/ca/client/tools/caput.c
index 9c50cd9..5e4d10e 100644
--- a/src/ca/client/tools/caput.c
+++ b/src/ca/client/tools/caput.c
@@ -530,6 +530,11 @@ int main (int argc, char *argv[])
         /* Use standard put with defined timeout */
         result = ca_array_put (dbrType, count, pvs[0].chid, pbuf);
     }
+ if (result != ECA_NORMAL) {
+ fprintf(stderr, "Error from put operation: %s\n", ca_message(result));
+ return 1;
+ }
+
     result = ca_pend_io(caTimeout);
     if (result == ECA_TIMEOUT) {
         fprintf(stderr, "Write operation timed out: Data was not written.\n");

Suggested additional enhancement:

@@ -545,7 +550,7 @@ int main (int argc, char *argv[])
     }

     if (result != ECA_NORMAL) {
- fprintf(stderr, "Error occured writing data.\n");
+ fprintf(stderr, "Error occured writing data: %s\n", ca_message(result))
         return 1;
     }

Changed in epics-base:
status: New → In Progress
assignee: nobody → Andrew Johnson (anj)
milestone: none → 3.15.6
Andrew Johnson (anj)
Changed in epics-base:
status: In Progress → Fix Committed
Changed in epics-base:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.