diff options
-rw-r--r-- | libvxi11client/libvxi11client.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c index 586e84f..601e490 100644 --- a/libvxi11client/libvxi11client.c +++ b/libvxi11client/libvxi11client.c @@ -200,8 +200,10 @@ int vxi11_write(VXI11Context* context, char* data, int len, bool waitlock, bool params.data.data_val = data; Device_WriteResp* resp = device_write_1(¶ms, context->clnt); - if (resp != NULL && resp->error == 0) + if (resp != NULL && resp->error == 0) { + errno = 0; return resp->size; + } else if (resp == NULL ) { errno = ERRNO_NULLRESULT; return 0; @@ -230,6 +232,7 @@ int vxi11_read(VXI11Context* context, char* buffer, unsigned int bufferlen, bool #ifdef DEBUG printf("Got \"%s\" from server\n", resp->data.data_val); #endif + errno = 0; if (buffer != NULL && resp->data.data_val != NULL ) { int lengthtocopy = ((bufferlen - 1) < resp->data.data_len ? (bufferlen - 1) : resp->data.data_len); strncpy(buffer, resp->data.data_val, lengthtocopy); |