net.c: when printing struct msghdr.msg_control, also print its name

* net.c (printcmsghdr): Skip control messages of zero length.
Always print "msg_control=" before the control message.
(do_msghdr): Print control message before its length, not after.
* tests/inet-cmsg.c (main): Update expected output.
* tests/scm_rights-fd.test: Likewise.
diff --git a/net.c b/net.c
index 113632c..6ffa713 100644
--- a/net.c
+++ b/net.c
@@ -341,9 +341,12 @@
 #endif
 			sizeof(struct cmsghdr);
 
+	if (!len)
+		return;
+	tprints(", msg_control=");
+
 	char *buf = len < cmsg_size ? NULL : malloc(len);
 	if (!buf || umoven(tcp, addr, len, buf) < 0) {
-		tprints(", msg_control=");
 		printaddr(addr);
 		free(buf);
 		return;
@@ -351,7 +354,7 @@
 
 	union_cmsghdr u = { .ptr = buf };
 
-	tprints(", [");
+	tprints("[");
 	while (len >= cmsg_size) {
 		size_t cmsg_len =
 #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
@@ -413,10 +416,10 @@
 	tprint_iov_upto(tcp, (unsigned long)msg->msg_iovlen,
 			(unsigned long)msg->msg_iov, IOV_DECODE_STR, data_size);
 
-	tprintf(", msg_controllen=%lu", (unsigned long)msg->msg_controllen);
-	if (msg->msg_controllen)
-		printcmsghdr(tcp, (unsigned long) msg->msg_control,
-			     msg->msg_controllen);
+	printcmsghdr(tcp, (unsigned long) msg->msg_control,
+		     msg->msg_controllen);
+	tprintf(", msg_controllen=%lu", (unsigned long) msg->msg_controllen);
+
 	tprints(", msg_flags=");
 	printflags(msg_flags, msg->msg_flags, "MSG_???");
 	tprints("}");