mq: print msg payload only in case of successful mq_timedreceive call

Also, use u_rval for determining message size.

* mq.c (SYS_FUNC(mq_timedreceive)): Check for syserror and non-negative
u_rval before calling printstr on msg_ptr argument, or use printaddr otherwise;
provide u_rval as string size.
This commit is contained in:
Eugene Syromyatnikov 2016-10-27 10:12:32 +03:00
parent 19bd947891
commit 26690859f6

5
mq.c
View File

@ -60,7 +60,10 @@ SYS_FUNC(mq_timedreceive)
if (entering(tcp)) {
tprintf("%d, ", (int) tcp->u_arg[0]);
} else {
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
if (!syserror(tcp) && (tcp->u_rval >= 0))
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
else
printaddr(tcp->u_arg[1]);
tprintf(", %llu, %ld, ", getarg_ull(tcp, 2), tcp->u_arg[3]);
/*
* Since the timeout parameter is read by the kernel