aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-09-21 17:13:30 +0200
committerlaforge <laforge@osmocom.org>2020-09-22 19:28:14 +0000
commit53fbc67d4eab779eb4194feddc17ed18cdb34693 (patch)
tree5a287cec237a788550bdbb15f9c951b0a724f654
parentc29d513a2b76bf689eb9a5d5914bd0f28065aa5d (diff)
osmo_strlcpy: Clarify length calculation
-rw-r--r--src/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index 168f85fe..772b6714 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -576,7 +576,7 @@ size_t osmo_strlcpy(char *dst, const char *src, size_t siz)
size_t ret = src ? strlen(src) : 0;
if (siz) {
- size_t len = (ret >= siz) ? siz - 1 : ret;
+ size_t len = OSMO_MIN(siz - 1, ret);
if (len)
memcpy(dst, src, len);
dst[len] = '\0';