strace/getrandom.c
Eugene Syromyatnikov c119a6da7c getrandom: print string as hex-escaped
Since there is no reason to interpret the value returned by getrandom as
ASCII string, it makes sense to always print it as a hex-escaped string.

* getrandom.c (SYS_FUNC(getrandom)): Use printstr_ex instead
of printstrn, set QUOTE_FORCE_HEX in user_style parameter in order
to force hex-escaped string formatting.
* tests/getrandom.test: Remove no longer needed -xx flag as the string
is always printed in hexadecimal format now.

Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-01-06 11:43:50 +00:00

17 lines
347 B
C

#include "defs.h"
#include "xlat/getrandom_flags.h"
SYS_FUNC(getrandom)
{
if (exiting(tcp)) {
if (syserror(tcp))
printaddr(tcp->u_arg[0]);
else
printstr_ex(tcp, tcp->u_arg[0], tcp->u_rval,
QUOTE_FORCE_HEX);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
printflags(getrandom_flags, tcp->u_arg[2], "GRND_???");
}
return 0;
}