summaryrefslogtreecommitdiffstats
path: root/src/basic/hostname-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-01-20 13:14:42 +0100
committerLennart Poettering <lennart@poettering.net>2023-01-20 17:27:51 +0100
commite8bec6242bf763afa7de7843d1daae567651c249 (patch)
tree9aba006f260fa4748530edc19fcf6f7a5bd9351d /src/basic/hostname-util.c
parentMerge pull request #23309 from DaanDeMeyer/log-context (diff)
downloadsystemd-e8bec6242bf763afa7de7843d1daae567651c249.tar.xz
systemd-e8bec6242bf763afa7de7843d1daae567651c249.zip
string-util: add new strdupcspn()/strdupspn()
These combine strndup() + strspn()/strcspn() into one. There are a bunch of strndupa() calls that could use similar treatment (or should be converted to strdup[c]spn(), but this commit doesn't bother with that.
Diffstat (limited to 'src/basic/hostname-util.c')
-rw-r--r--src/basic/hostname-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c
index b710f07929..e743033b1e 100644
--- a/src/basic/hostname-util.c
+++ b/src/basic/hostname-util.c
@@ -62,7 +62,7 @@ int gethostname_full(GetHostnameFlags flags, char **ret) {
}
if (FLAGS_SET(flags, GET_HOSTNAME_SHORT))
- buf = strndup(s, strcspn(s, "."));
+ buf = strdupcspn(s, ".");
else
buf = strdup(s);
if (!buf)