diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-01-20 13:14:42 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-01-20 17:27:51 +0100 |
commit | e8bec6242bf763afa7de7843d1daae567651c249 (patch) | |
tree | 9aba006f260fa4748530edc19fcf6f7a5bd9351d /src/basic/hostname-util.c | |
parent | Merge pull request #23309 from DaanDeMeyer/log-context (diff) | |
download | systemd-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.c | 2 |
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) |