* Copyright (c) 2012-2013 Denys Vlasenko <vda.linux@googlemail.com>
* Copyright (c) 2014 Masatake YAMATO <yamato@redhat.com>
* Copyright (c) 2010-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "defs.h"
#include "msghdr.h"
+#include "xstring.h"
#include <limits.h>
-static int
-fetch_struct_mmsghdr_or_printaddr(struct tcb *const tcp,
+static bool
+fetch_struct_mmsghdr_for_print(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len, void *const mh)
{
- if ((entering(tcp) || !syserror(tcp))
- && fetch_struct_mmsghdr(tcp, addr, mh)) {
- return 0;
- } else {
- printaddr(addr);
- return -1;
- }
+ return (entering(tcp) || !syserror(tcp)) &&
+ fetch_struct_mmsghdr(tcp, addr, mh);
}
struct print_struct_mmsghdr_config {
}
print_array(tcp, addr, vlen, &mmsg, sizeof_struct_mmsghdr(),
- fetch_struct_mmsghdr_or_printaddr,
+ fetch_struct_mmsghdr_for_print,
print_struct_mmsghdr, &c);
}
return 0;
/* timeout on exit */
static char str[sizeof("left") + TIMESPEC_TEXT_BUFSIZE];
- snprintf(str, sizeof(str), "left %s",
- sprint_timespec(tcp, tcp->u_arg[4]));
+ xsprintf(str, "left %s", sprint_timespec(tcp, tcp->u_arg[4]));
tcp->auxstr = str;
return RVAL_STR;
}