Module Name:    src
Committed By:   rmind
Date:           Sun Sep 23 21:35:26 UTC 2018

Modified Files:
        src/sys/external/bsd/libnv/dist: nv_kern_netbsd.c

Log Message:
nvlist_copyin: fix the flag handling.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c
diff -u src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.4 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.5
--- src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.4	Sun Sep 23 19:07:10 2018
+++ src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c	Sun Sep 23 21:35:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nv_kern_netbsd.c,v 1.4 2018/09/23 19:07:10 rmind Exp $	*/
+/*	$NetBSD: nv_kern_netbsd.c,v 1.5 2018/09/23 21:35:26 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.4 2018/09/23 19:07:10 rmind Exp $");
+__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.5 2018/09/23 21:35:26 rmind Exp $");
 
 #if !defined(_KERNEL) && !defined(_STANDALONE)
 #include <sys/mman.h>
@@ -74,9 +74,9 @@ int
 nvlist_copyin(const nvlist_ref_t *nref, nvlist_t **nvlp, size_t lim)
 {
 	const size_t len = nref->len;
+	int flags, error;
 	nvlist_t *nvl;
 	void *buf;
-	int error;
 
 	if (len >= lim) {
 		return E2BIG;
@@ -87,7 +87,8 @@ nvlist_copyin(const nvlist_ref_t *nref, 
 		kmem_free(buf, len);
 		return error;
 	}
-	nvl = nvlist_unpack(buf, len, nref->flags);
+	flags = nref->flags & (NV_FLAG_IGNORE_CASE | NV_FLAG_NO_UNIQUE);
+	nvl = nvlist_unpack(buf, len, flags);
 	kmem_free(buf, len);
 	if (nvl == NULL) {
 		return EINVAL;
@@ -126,7 +127,7 @@ nvlist_copyout(nvlist_ref_t *nref, const
 		    (vaddr_t)uaddr + len);
 		goto err;
 	}
-	nref->flags = nvlist_error(nvl);
+	nref->flags = nvlist_flags(nvl);
 	nref->buf = uaddr;
 	nref->len = len;
 err:

Reply via email to