ipc: mach_complete_[a]sync avoid 'ret' set but not used warning
The variable 'ret' is set but not used. As the value is ignored remove it. Restructure the initialization of 'replyinCnt', 'replyout', and 'replyoutCnt' such that a failure of vm_read() results in a properly initialized reply structure.
This commit is contained in:
@@ -122,26 +122,19 @@ mach_complete_sync(heim_sipc_call ctx, int returnvalue, heim_idata *reply)
|
|||||||
{
|
{
|
||||||
struct mach_call_ctx *s = (struct mach_call_ctx *)ctx;
|
struct mach_call_ctx *s = (struct mach_call_ctx *)ctx;
|
||||||
heim_ipc_message_inband_t replyin;
|
heim_ipc_message_inband_t replyin;
|
||||||
mach_msg_type_number_t replyinCnt;
|
mach_msg_type_number_t replyinCnt = 0;
|
||||||
heim_ipc_message_outband_t replyout;
|
heim_ipc_message_outband_t replyout = 0;
|
||||||
mach_msg_type_number_t replyoutCnt;
|
mach_msg_type_number_t replyoutCnt = 0;
|
||||||
kern_return_t kr;
|
|
||||||
|
|
||||||
if (returnvalue) {
|
if (returnvalue) {
|
||||||
/* on error, no reply */
|
/* on error, no reply */
|
||||||
replyinCnt = 0;
|
|
||||||
replyout = 0; replyoutCnt = 0;
|
|
||||||
kr = KERN_SUCCESS;
|
|
||||||
} else if (reply->length < 2048) {
|
} else if (reply->length < 2048) {
|
||||||
replyinCnt = reply->length;
|
replyinCnt = reply->length;
|
||||||
memcpy(replyin, reply->data, replyinCnt);
|
memcpy(replyin, reply->data, replyinCnt);
|
||||||
replyout = 0; replyoutCnt = 0;
|
|
||||||
kr = KERN_SUCCESS;
|
|
||||||
} else {
|
} else {
|
||||||
replyinCnt = 0;
|
vm_read(mach_task_self(),
|
||||||
kr = vm_read(mach_task_self(),
|
(vm_address_t)reply->data, reply->length,
|
||||||
(vm_address_t)reply->data, reply->length,
|
(vm_address_t *)&replyout, &replyoutCnt);
|
||||||
(vm_address_t *)&replyout, &replyoutCnt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mheim_ripc_call_reply(s->reply_port, returnvalue,
|
mheim_ripc_call_reply(s->reply_port, returnvalue,
|
||||||
@@ -159,31 +152,24 @@ mach_complete_async(heim_sipc_call ctx, int returnvalue, heim_idata *reply)
|
|||||||
{
|
{
|
||||||
struct mach_call_ctx *s = (struct mach_call_ctx *)ctx;
|
struct mach_call_ctx *s = (struct mach_call_ctx *)ctx;
|
||||||
heim_ipc_message_inband_t replyin;
|
heim_ipc_message_inband_t replyin;
|
||||||
mach_msg_type_number_t replyinCnt;
|
mach_msg_type_number_t replyinCnt = 0;
|
||||||
heim_ipc_message_outband_t replyout;
|
heim_ipc_message_outband_t replyout = 0;
|
||||||
mach_msg_type_number_t replyoutCnt;
|
mach_msg_type_number_t replyoutCnt = 0;
|
||||||
kern_return_t kr;
|
|
||||||
|
|
||||||
if (returnvalue) {
|
if (returnvalue) {
|
||||||
/* on error, no reply */
|
/* on error, no reply */
|
||||||
replyinCnt = 0;
|
|
||||||
replyout = 0; replyoutCnt = 0;
|
|
||||||
kr = KERN_SUCCESS;
|
|
||||||
} else if (reply->length < 2048) {
|
} else if (reply->length < 2048) {
|
||||||
replyinCnt = reply->length;
|
replyinCnt = reply->length;
|
||||||
memcpy(replyin, reply->data, replyinCnt);
|
memcpy(replyin, reply->data, replyinCnt);
|
||||||
replyout = 0; replyoutCnt = 0;
|
|
||||||
kr = KERN_SUCCESS;
|
|
||||||
} else {
|
} else {
|
||||||
replyinCnt = 0;
|
vm_read(mach_task_self(),
|
||||||
kr = vm_read(mach_task_self(),
|
(vm_address_t)reply->data, reply->length,
|
||||||
(vm_address_t)reply->data, reply->length,
|
(vm_address_t *)&replyout, &replyoutCnt);
|
||||||
(vm_address_t *)&replyout, &replyoutCnt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kr = mheim_aipc_acall_reply(s->reply_port, returnvalue,
|
mheim_aipc_acall_reply(s->reply_port, returnvalue,
|
||||||
replyin, replyinCnt,
|
replyin, replyinCnt,
|
||||||
replyout, replyoutCnt);
|
replyout, replyoutCnt);
|
||||||
heim_ipc_free_cred(s->cred);
|
heim_ipc_free_cred(s->cred);
|
||||||
free(s->req.data);
|
free(s->req.data);
|
||||||
free(s);
|
free(s);
|
||||||
@@ -1383,4 +1369,3 @@ heim_ipc_main(void)
|
|||||||
process_loop();
|
process_loop();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user