summaryrefslogtreecommitdiff
path: root/src/locale
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2020-03-27 09:11:55 +0100
committerAdrian Szyndela <adrian.s@samsung.com>2020-03-27 09:11:55 +0100
commitb0d0a1cb41408251e852bce998aff876fda0b214 (patch)
tree7c0539331c52802a9609c708150e3d7fb4283dd7 /src/locale
parenta70b405fa3b2c4e93db2b3bd858d70b5ef559a1e (diff)
parent1e5d2d656420d0e755dbcf72aeba3c3aba54e956 (diff)
downloadsystemd-b0d0a1cb41408251e852bce998aff876fda0b214.tar.gz
systemd-b0d0a1cb41408251e852bce998aff876fda0b214.tar.bz2
systemd-b0d0a1cb41408251e852bce998aff876fda0b214.zip
Merge v242 into tizen
systemd v242
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/keymap-util.c30
-rw-r--r--src/locale/localectl.c4
-rw-r--r--src/locale/localed.c2
-rw-r--r--src/locale/test-keymap-util.c4
4 files changed, 20 insertions, 20 deletions
diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
index 6b6b32a591..b8bd181c16 100644
--- a/src/locale/keymap-util.c
+++ b/src/locale/keymap-util.c
@@ -3,20 +3,23 @@
#include <errno.h>
#include <stdio_ext.h>
#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
#include "bus-util.h"
-#include "def.h"
-#include "env-file.h"
#include "env-file-label.h"
+#include "env-file.h"
#include "env-util.h"
#include "fd-util.h"
#include "fileio-label.h"
#include "fileio.h"
+#include "kbd-util.h"
#include "keymap-util.h"
#include "locale-util.h"
#include "macro.h"
#include "mkdir.h"
+#include "nulstr-util.h"
#include "string-util.h"
#include "strv.h"
#include "tmpfile-util.h"
@@ -29,10 +32,6 @@ static bool startswith_comma(const char *s, const char *prefix) {
return IN_SET(*s, ',', '\0');
}
-static const char* strnulldash(const char *s) {
- return isempty(s) || streq(s, "-") ? NULL : s;
-}
-
static const char* systemd_kbd_model_map(void) {
const char* s;
@@ -419,8 +418,7 @@ int x11_write_data(Context *c) {
return 0;
}
- mkdir_p_label("/etc/X11/xorg.conf.d", 0755);
-
+ (void) mkdir_p_label("/etc/X11/xorg.conf.d", 0755);
r = fopen_temporary("/etc/X11/xorg.conf.d/00-keyboard.conf", &f, &temp_path);
if (r < 0)
return r;
@@ -549,15 +547,15 @@ int vconsole_convert_to_x11(Context *c) {
if (!streq(c->vc_keymap, a[0]))
continue;
- if (!streq_ptr(c->x11_layout, strnulldash(a[1])) ||
- !streq_ptr(c->x11_model, strnulldash(a[2])) ||
- !streq_ptr(c->x11_variant, strnulldash(a[3])) ||
- !streq_ptr(c->x11_options, strnulldash(a[4]))) {
+ if (!streq_ptr(c->x11_layout, empty_or_dash_to_null(a[1])) ||
+ !streq_ptr(c->x11_model, empty_or_dash_to_null(a[2])) ||
+ !streq_ptr(c->x11_variant, empty_or_dash_to_null(a[3])) ||
+ !streq_ptr(c->x11_options, empty_or_dash_to_null(a[4]))) {
- if (free_and_strdup(&c->x11_layout, strnulldash(a[1])) < 0 ||
- free_and_strdup(&c->x11_model, strnulldash(a[2])) < 0 ||
- free_and_strdup(&c->x11_variant, strnulldash(a[3])) < 0 ||
- free_and_strdup(&c->x11_options, strnulldash(a[4])) < 0)
+ if (free_and_strdup(&c->x11_layout, empty_or_dash_to_null(a[1])) < 0 ||
+ free_and_strdup(&c->x11_model, empty_or_dash_to_null(a[2])) < 0 ||
+ free_and_strdup(&c->x11_variant, empty_or_dash_to_null(a[3])) < 0 ||
+ free_and_strdup(&c->x11_options, empty_or_dash_to_null(a[4])) < 0)
return -ENOMEM;
modified = true;
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 69f5667801..c8b195d9a6 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -11,18 +11,18 @@
#include "bus-error.h"
#include "bus-util.h"
-#include "def.h"
#include "fd-util.h"
#include "fileio.h"
+#include "kbd-util.h"
#include "locale-util.h"
#include "main-func.h"
+#include "memory-util.h"
#include "pager.h"
#include "pretty-print.h"
#include "proc-cmdline.h"
#include "set.h"
#include "spawn-polkit-agent.h"
#include "strv.h"
-#include "util.h"
#include "verbs.h"
#include "virt.h"
diff --git a/src/locale/localed.c b/src/locale/localed.c
index f851d35a08..8d0eec96a5 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -2,6 +2,8 @@
#include <errno.h>
#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
#if HAVE_XKBCOMMON
diff --git a/src/locale/test-keymap-util.c b/src/locale/test-keymap-util.c
index 2f82891d60..f96f5b07ec 100644
--- a/src/locale/test-keymap-util.c
+++ b/src/locale/test-keymap-util.c
@@ -4,6 +4,7 @@
#include "keymap-util.h"
#include "log.h"
#include "string-util.h"
+#include "tests.h"
static void test_find_language_fallback(void) {
_cleanup_free_ char *ans = NULL, *ans2 = NULL;
@@ -189,8 +190,7 @@ static void test_x11_convert_to_vconsole(void) {
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
test_find_language_fallback();
test_find_converted_keymap();