From owner-svn-src-all@freebsd.org Mon Dec 28 00:53:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 457F9A512DA; Mon, 28 Dec 2015 00:53:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE84C10C0; Mon, 28 Dec 2015 00:53:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS0rckG071805; Mon, 28 Dec 2015 00:53:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS0rbxg071804; Mon, 28 Dec 2015 00:53:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280053.tBS0rbxg071804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 00:53:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292814 - head/tools/regression/sockets/unix_passfd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 00:53:39 -0000 Author: ngie Date: Mon Dec 28 00:53:37 2015 New Revision: 292814 URL: https://svnweb.freebsd.org/changeset/base/292814 Log: - Explicitly initialize ch to 0 - Delete some spurious whitespace - Use calloc instead of malloc in the last test to ensure that sendspace is properly zero'ed out Differential Revision: https://reviews.freebsd.org/D689 (part of a larger diff) MFC after: 1 week Reviewed by: asomers, ngie Submitted by: markj Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/sockets/unix_passfd/unix_passfd.c Modified: head/tools/regression/sockets/unix_passfd/unix_passfd.c ============================================================================== --- head/tools/regression/sockets/unix_passfd/unix_passfd.c Mon Dec 28 00:42:15 2015 (r292813) +++ head/tools/regression/sockets/unix_passfd/unix_passfd.c Mon Dec 28 00:53:37 2015 (r292814) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2005 Robert N. M. Watson + * Copyright (c) 2015 Mark Johnston * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -146,7 +147,7 @@ sendfd_payload(const char *test, int soc static void sendfd(const char *test, int sockfd, int sendfd) { - char ch; + char ch = 0; return (sendfd_payload(test, sockfd, sendfd, &ch, sizeof(ch))); } @@ -199,7 +200,7 @@ recvfd_payload(const char *test, int soc static void recvfd(const char *test, int sockfd, int *recvfd) { - char ch; + char ch = 0; return (recvfd_payload(test, sockfd, recvfd, &ch, sizeof(ch))); } @@ -369,8 +370,8 @@ main(void) err(-1, "%s: sysctlbyname(net.local.stream.sendspace)", test); - if ((buf = malloc(sendspace)) == NULL) - err(-1, "%s: malloc", test); + if ((buf = calloc(1, sendspace)) == NULL) + err(-1, "%s: calloc", test); domainsocketpair(test, fd); if (setsockopt(fd[1], 0, LOCAL_CREDS, &on, sizeof(on)) < 0) @@ -384,6 +385,6 @@ main(void) } printf("%s passed\n", test); - + return (0); }