systemd/0313-nulstr-util-make-ret_size-in-strv_make_nulstr-option.patch
Jan Macku ea71a49292 systemd-252-18
Resolves: #2161260,#2170883,#2178222,#2190226,#2209912,#2211065,#2213521,#2226980,#2230364,#2231845
2023-08-22 13:24:53 +02:00

35 lines
1012 B
Diff

From 0770b3b7af5f11a65bc11307789c2ed45e5c8155 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Mon, 8 May 2023 20:06:33 +0900
Subject: [PATCH] nulstr-util: make ret_size in strv_make_nulstr() optional
(cherry picked from commit 16cda99c737714d6d259e45808e39f94408d90bd)
Related: #2190226
---
src/basic/strv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 24fc56a1a5..66b70befd6 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -706,7 +706,6 @@ int strv_make_nulstr(char * const *l, char **ret, size_t *ret_size) {
size_t n = 0;
assert(ret);
- assert(ret_size);
STRV_FOREACH(i, l) {
size_t z;
@@ -731,7 +730,8 @@ int strv_make_nulstr(char * const *l, char **ret, size_t *ret_size) {
assert(n > 0);
*ret = TAKE_PTR(m);
- *ret_size = n - 1;
+ if (ret_size)
+ *ret_size = n - 1;
return 0;
}