svn commit: r332252 - stable/11/usr.bin/truss

Michael Tuexen tuexen at FreeBSD.org
Sat Apr 7 21:08:45 UTC 2018


Author: tuexen
Date: Sat Apr  7 21:08:44 2018
New Revision: 332252
URL: https://svnweb.freebsd.org/changeset/base/332252

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

Modified:
  stable/11/usr.bin/truss/syscalls.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/truss/syscalls.c
==============================================================================
--- stable/11/usr.bin/truss/syscalls.c	Sat Apr  7 21:07:47 2018	(r332251)
+++ stable/11/usr.bin/truss/syscalls.c	Sat Apr  7 21:08:44 2018	(r332252)
@@ -1476,10 +1476,15 @@ print_cmsgs(FILE *fp, pid_t pid, bool recv, struct msg
 	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