Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Apr 2018 21:08:44 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332252 - stable/11/usr.bin/truss
Message-ID:  <201804072108.w37L8iWU009687@repo.freebsd.org>

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



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