catools: Fix SEGFAULT from bad PV names

This commit is contained in:
Andrew Johnson
2017-04-27 10:52:07 -05:00
parent c22670cbb0
commit f2e54be965
2 changed files with 6 additions and 5 deletions

View File

@@ -541,11 +541,11 @@ int main (int argc, char *argv[])
for (n = 0; optind < argc; n++, optind++)
pvs[n].name = argv[optind] ; /* Copy PV names from command line */
connect_pvs(pvs, nPvs);
result = connect_pvs(pvs, nPvs);
/* Read and print data */
result = caget(pvs, nPvs, request, format, type, count);
if (!result)
result = caget(pvs, nPvs, request, format, type, count);
/* Shut down Channel Access */
ca_context_destroy();

View File

@@ -211,10 +211,11 @@ int main (int argc, char *argv[])
for (n = 0; optind < argc; n++, optind++)
pvs[n].name = argv[optind] ; /* Copy PV names from command line */
connect_pvs(pvs, nPvs);
result = connect_pvs(pvs, nPvs);
/* Print data */
result = cainfo(pvs, nPvs);
if (!result)
result = cainfo(pvs, nPvs);
/* Shut down Channel Access */
ca_context_destroy();