Check umove() return code
* bjm.c (sys_query_module): Print input parameters when entering
syscall. Fix handling of syscall error. Handle unlikely umove()
failures.
* ipc.c (tprint_msgrcv): New function. Move part of msgrcv parser code
here, add check umove() return code.
(sys_msgsnd): Print msqid parameter as int instead of long.
(sys_msgrcv): Likewise. Use tprint_msgrcv().
* process.c (print_affinitylist): Check umove() return code.
* sock.c (sock_ioctl): Handle unlikely umove() failure in the
SIOCGIFCONF parser.
diff --git a/process.c b/process.c
index 551e1bb..ee8a7bc 100644
--- a/process.c
+++ b/process.c
@@ -3546,16 +3546,32 @@
print_affinitylist(struct tcb *tcp, long list, unsigned int len)
{
int first = 1;
- tprintf(" {");
- while (len >= sizeof (unsigned long)) {
- unsigned long w;
- umove(tcp, list, &w);
- tprintf("%s %lx", first ? "" : ",", w);
+ unsigned long w, min_len;
+
+ if (abbrev(tcp) && len / sizeof(w) > max_strlen)
+ min_len = len - max_strlen * sizeof(w);
+ else
+ min_len = 0;
+ for (; len >= sizeof(w) && len > min_len;
+ len -= sizeof(w), list += sizeof(w)) {
+ if (umove(tcp, list, &w) < 0)
+ break;
+ if (first)
+ tprintf("{");
+ else
+ tprintf(", ");
first = 0;
- len -= sizeof (unsigned long);
- list += sizeof(unsigned long);
+ tprintf("%lx", w);
}
- tprintf(" }");
+ if (len) {
+ if (first)
+ tprintf("%#lx", list);
+ else
+ tprintf(", %s}", (len >= sizeof(w) && len > min_len ?
+ "???" : "..."));
+ } else {
+ tprintf(first ? "{}" : "}");
+ }
}
int