svn commit: r328059 - head/usr.bin/truss

Michael Tuexen tuexen at FreeBSD.org
Tue Jan 16 20:02:09 UTC 2018


Author: tuexen
Date: Tue Jan 16 20:02:07 2018
New Revision: 328059
URL: https://svnweb.freebsd.org/changeset/base/328059

Log:
  Improve the printing of cmgs when the length is 0. Fix error handling.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==============================================================================
--- head/usr.bin/truss/syscalls.c	Tue Jan 16 19:57:30 2018	(r328058)
+++ head/usr.bin/truss/syscalls.c	Tue Jan 16 20:02:07 2018	(r328059)
@@ -1493,10 +1493,15 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct 
 	bool first;
 
 	len = msghdr->msg_controllen;
+	if (len == 0) {
+		fputs("{}", fp);
+		return;
+	}
 	cmsgbuf = calloc(1, len);
 	if (get_struct(pid, msghdr->msg_control, cmsgbuf, len) == -1) {
 		fprintf(fp, "%p", msghdr->msg_control);
 		free(cmsgbuf);
+		return;
 	}
 	msghdr->msg_control = cmsgbuf;
 	first = true;


More information about the svn-src-all mailing list