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