Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jan 2018 20:02:07 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328059 - head/usr.bin/truss
Message-ID:  <201801162002.w0GK27Wv044588@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801162002.w0GK27Wv044588>