From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:16:34 2016 Return-Path: Delivered-To: svn-src-stable-11@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 C1572C0DD2F; Wed, 12 Oct 2016 05:16:34 +0000 (UTC) (envelope-from mav@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 9E79973; Wed, 12 Oct 2016 05:16:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5GXGW012368; Wed, 12 Oct 2016 05:16:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5GX5L012366; Wed, 12 Oct 2016 05:16:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120516.u9C5GX5L012366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307110 - in stable/11: cddl/contrib/opensolaris/lib/libnvpair sys/cddl/contrib/opensolaris/common/nvpair X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:16:34 -0000 Author: mav Date: Wed Oct 12 05:16:33 2016 New Revision: 307110 URL: https://svnweb.freebsd.org/changeset/base/307110 Log: MFC r305211: MFV r302662: 6447 handful of nvpair cleanups illumos/illumos-gate@759e89be359f2af635e4122d147df56bce948773 https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bc e948773 https://www.illumos.org/issues/6447 I got a patch from someone who uses nvpair code outside of illumos. It fixes a couple of gcc warnings/bugs for him. 1. silence uninitialized use warnings 2. add parentheses around assignment used as truth value 3. fix printf format specifier (ll is for integers only) 4. strstr, strspn, strcspn, and strcmp are declared in string.h, not strings.h. 5. avoid scanning integer into boolean variable Reviewed by: Josef 'Jeff' Sipek Reviewed by: Andy Stormont Reviewed by: Garrett D'Amore Approved by: Robert Mustacchi Author: Steve Dougherty Modified: stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c Wed Oct 12 05:15:53 2016 (r307109) +++ stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c Wed Oct 12 05:16:33 2016 (r307110) @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include "libnvpair.h" @@ -1228,7 +1228,8 @@ nvpair_value_match_regex(nvpair_t *nvp, break; } case DATA_TYPE_BOOLEAN_VALUE: { - boolean_t val, val_arg; + int32_t val_arg; + boolean_t val; /* scanf boolean_t from value and check for match */ sr = sscanf(value, "%"SCNi32, &val_arg); @@ -1239,7 +1240,8 @@ nvpair_value_match_regex(nvpair_t *nvp, break; } case DATA_TYPE_BOOLEAN_ARRAY: { - boolean_t *val_array, val_arg; + boolean_t *val_array; + int32_t val_arg; /* check indexed value of array for match */ sr = sscanf(value, "%"SCNi32, &val_arg); Modified: stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Wed Oct 12 05:15:53 2016 (r307109) +++ stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Wed Oct 12 05:16:33 2016 (r307110) @@ -1629,6 +1629,8 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nv if ((nvl == NULL) || (name == NULL)) return (EINVAL); + sepp = NULL; + idx = 0; /* step through components of name */ for (np = name; np && *np; np = sepp) { /* ensure unique names */ @@ -2386,7 +2388,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, */ nv_priv_init(&nvpriv, nva, 0); - if (err = nvlist_size(nvl, &alloc_size, encoding)) + if ((err = nvlist_size(nvl, &alloc_size, encoding))) return (err); if ((buf = nv_mem_zalloc(&nvpriv, alloc_size)) == NULL)