Skip to content

Commit

Permalink
Don't use pasynUser->errorMessage as simultaneous source and destinat…
Browse files Browse the repository at this point in the history
…ion.

Don't use deprecated library routine.
  • Loading branch information
norumwe12 committed Oct 18, 2021
1 parent ed970dd commit 66c1015
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions asyn/drvAsynUSBTMC/drvAsynUSBTMC.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ report(void *pvt, FILE *fp, int details)
if (details >= 100) {
int l = details % 100;
fprintf(fp, "==== Set libusb debug level %d ====\n", l);
libusb_set_debug(pdpvt->usb, l);
libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, loglevel);
}
}

Expand Down Expand Up @@ -628,15 +628,19 @@ connect(void *pvt, asynUser *pasynUser)
return asynError;
}
if (getCapabilities(pdpvt, pasynUser) != asynSuccess) {
char *msg = epicsStrDup(pasynUser->errorMessage);
libusb_close(pdpvt->handle);
epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
"Can't get device capabilities: %s", pasynUser->errorMessage);
"Can't get device capabilities: %s", msg);
free(msg);
return asynError;
}
if (clearBuffers(pdpvt, pasynUser) != asynSuccess) {
char *msg = epicsStrDup(pasynUser->errorMessage);
libusb_close(pdpvt->handle);
epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
"Can't clear buffers: %s", pasynUser->errorMessage);
"Can't clear buffers: %s", msg);
free(msg);
return asynError;
}
pdpvt->bulkInPacketFlags = 0;
Expand Down

0 comments on commit 66c1015

Please sign in to comment.