diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-07-21 20:23:51 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-07-22 12:59:36 +0200 |
commit | 9ca8d43479dc198e8d6fc86492aa6576f97bbfc2 (patch) | |
tree | 5f89f1d15bc4016d7014aff71306af38cee6d938 /src | |
parent | e042eab7200b0c96c19f80100e3624bdba653a92 (diff) |
sd-id128: handle NULL return parameter in sd_id128_from_string() nicer
If the return parameter is NULL, simply validate the string, and return no
error.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-id128/sd-id128.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd/sd-id128/sd-id128.c b/src/libsystemd/sd-id128/sd-id128.c index 1470e4c01a..9f47d04e61 100644 --- a/src/libsystemd/sd-id128/sd-id128.c +++ b/src/libsystemd/sd-id128/sd-id128.c @@ -52,7 +52,6 @@ _public_ int sd_id128_from_string(const char s[], sd_id128_t *ret) { bool is_guid = false; assert_return(s, -EINVAL); - assert_return(ret, -EINVAL); for (n = 0, i = 0; n < 16;) { int a, b; @@ -90,7 +89,8 @@ _public_ int sd_id128_from_string(const char s[], sd_id128_t *ret) { if (s[i] != 0) return -EINVAL; - *ret = t; + if (ret) + *ret = t; return 0; } |