bd1529
From 91ed5edcdea79773f6918e739637521e47129b07 Mon Sep 17 00:00:00 2001
bd1529
From: Lennart Poettering <lennart@poettering.net>
bd1529
Date: Mon, 1 Jun 2020 17:10:27 +0200
bd1529
Subject: [PATCH] parse-util: make return parameter optional in
bd1529
 safe_atou16_full()
bd1529
bd1529
All other safe_atoXYZ_full() functions have the parameter optional,
bd1529
let's make it optoinal here, too.
bd1529
bd1529
(cherry picked from commit aa85e4d3cef8ca8436e480bce9fa4ce72876b636)
bd1529
bd1529
Related: #1848373
bd1529
---
bd1529
 src/basic/parse-util.c | 4 +++-
bd1529
 1 file changed, 3 insertions(+), 1 deletion(-)
bd1529
bd1529
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
bd1529
index 53d181dd60..7a7cefe6ff 100644
bd1529
--- a/src/basic/parse-util.c
bd1529
+++ b/src/basic/parse-util.c
bd1529
@@ -559,7 +559,9 @@ int safe_atou16_full(const char *s, unsigned base, uint16_t *ret) {
bd1529
         if ((unsigned long) (uint16_t) l != l)
bd1529
                 return -ERANGE;
bd1529
 
bd1529
-        *ret = (uint16_t) l;
bd1529
+        if (ret)
bd1529
+                *ret = (uint16_t) l;
bd1529
+
bd1529
         return 0;
bd1529
 }
bd1529