changeset 832:76e588fedba8

nvl: make nvpair_value return -ENOENT for NULL pairs This brings it in line with the rest of the nvpair_value_* functions. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Mon, 01 Mar 2021 19:35:15 -0500
parents 1475c8609196
children 19b58acf0e3b
files include/jeffpc/nvl.h
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/include/jeffpc/nvl.h	Mon Feb 22 08:21:03 2021 -0500
+++ b/include/jeffpc/nvl.h	Mon Mar 01 19:35:15 2021 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2017-2021 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -227,7 +227,7 @@
 
 static inline struct val *nvpair_value(const struct nvpair *pair)
 {
-	return val_getref(pair->value);
+	return pair ? val_getref(pair->value) : ERR_PTR(-ENOENT);
 }
 
 /*