summaryrefslogtreecommitdiffstats
path: root/src/locale
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-03-19 18:27:04 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-03-20 15:13:44 +0100
commit454318d3e86c125a78e61a825d84db1b52c1a4a9 (patch)
treeec46d6c3506a588343a050823b796c1c828274f8 /src/locale
parenttest-cgroup-util: reduce scope of iterator variables (diff)
downloadsystemd-454318d3e86c125a78e61a825d84db1b52c1a4a9.tar.xz
systemd-454318d3e86c125a78e61a825d84db1b52c1a4a9.zip
various: use strdup_to() in various obvious cases
strdup_to() returns 0 on success and here we convert obvious blocks which either return -ENOMEM or 0.
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/localed.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 5758a2624c..c0d104578d 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -158,11 +158,7 @@ static int process_locale_list_item(
if (new_locale[p])
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Locale variable %s set twice, refusing.", name);
- new_locale[p] = strdup(e);
- if (!new_locale[p])
- return -ENOMEM;
-
- return 0;
+ return strdup_to(&new_locale[p], e);
}
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Locale assignment %s not valid, refusing.", assignment);