[PATCH] lib: Fix strv_next for the anchor NULL entry
Volker Lendecke
Volker.Lendecke at SerNet.DE
Wed May 6 08:41:52 MDT 2015
Hi!
This whole strv thingy does not work properly without this
patch. I must have had this in an earlier version, I did
test with multiple reservations in server_id_db.
Review&push appreciated!
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From dbe84ccfc49850af13219720ca2636baa7986639 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 28 Apr 2015 10:28:52 +0200
Subject: [PATCH] lib: Fix strv_next for the anchor NULL entry
I swear I have tested this somewhere....
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/util/strv.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/util/strv.c b/lib/util/strv.c
index 2acd145..f5879c7 100644
--- a/lib/util/strv.c
+++ b/lib/util/strv.c
@@ -84,6 +84,13 @@ char *strv_next(char *strv, const char *entry)
size_t len, entry_len;
char *result;
+ if (entry == NULL) {
+ if (strv_valid_entry(strv, strv, &len, &entry_len)) {
+ return strv;
+ }
+ return NULL;
+ }
+
if (!strv_valid_entry(strv, entry, &len, &entry_len)) {
return NULL;
}
--
1.9.1
More information about the samba-technical
mailing list