From 5ca38c3d82fdca7be88787b951c832789c9b904e Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 24 Jan 2013 22:45:08 +0900 Subject: make read cleaner --- vxi11_server.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/vxi11_server.c b/vxi11_server.c index 43d6ef3..ed529f2 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -189,11 +189,11 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) { printf("device_read_1_svc()\n"); #endif - if (result.data.data_val != NULL) { + // this free's the data from the last call + if (result.data.data_val != NULL) g_free(result.data.data_val); - result.data.data_val = NULL; - result.data.data_len = 0; - } + + memset(&result, 0, sizeof(result)); if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; @@ -211,11 +211,9 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) { printf("sending ---%s---\n", result.data.data_val); #endif } - else { + else result.data.data_val = NULL; - result.data.data_len = 0; - } - result.error = 0; + result.reason = 0x4; } return &result; -- cgit