chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
networkd: remove "*" from domains list
[elogind.git]
/
src
/
locale
/
localed.c
diff --git
a/src/locale/localed.c
b/src/locale/localed.c
index 358f6c200eef31372cafbbf44c9e7aac8b7ddd77..3cfc2ea4d3029d0b476581c18eb87e2b6cff60db 100644
(file)
--- a/
src/locale/localed.c
+++ b/
src/locale/localed.c
@@
-38,6
+38,7
@@
#include "bus-error.h"
#include "bus-message.h"
#include "event-util.h"
#include "bus-error.h"
#include "bus-message.h"
#include "event-util.h"
+#include "locale-util.h"
enum {
/* We don't list LC_ALL here on purpose. People should be
enum {
/* We don't list LC_ALL here on purpose. People should be
@@
-209,6
+210,7
@@
static int x11_read_data(Context *c) {
FILE *f;
char line[LINE_MAX];
bool in_section = false;
FILE *f;
char line[LINE_MAX];
bool in_section = false;
+ int r;
context_free_x11(c);
context_free_x11(c);
@@
-228,10
+230,10
@@
static int x11_read_data(Context *c) {
if (in_section && first_word(l, "Option")) {
char **a;
if (in_section && first_word(l, "Option")) {
char **a;
-
a = strv_split_quoted(
l);
- if (
!a
) {
+
r = strv_split_quoted(&a,
l);
+ if (
r < 0
) {
fclose(f);
fclose(f);
- return
-ENOMEM
;
+ return
r
;
}
if (strv_length(a) == 3) {
}
if (strv_length(a) == 3) {
@@
-255,8
+257,8
@@
static int x11_read_data(Context *c) {
} else if (!in_section && first_word(l, "Section")) {
char **a;
} else if (!in_section && first_word(l, "Section")) {
char **a;
-
a = strv_split_quoted(
l);
- if (
!a
) {
+
r = strv_split_quoted(&a,
l);
+ if (
r < 0
) {
fclose(f);
return -ENOMEM;
}
fclose(f);
return -ENOMEM;
}
@@
-288,7
+290,7
@@
static int locale_write_data(Context *c) {
int r, p;
char **l = NULL;
int r, p;
char **l = NULL;
- r = load_env_file("/etc/locale.conf", NULL, &l);
+ r = load_env_file(
NULL,
"/etc/locale.conf", NULL, &l);
if (r < 0 && r != -ENOENT)
return r;
if (r < 0 && r != -ENOENT)
return r;
@@
-393,7
+395,7
@@
static int vconsole_write_data(Context *c) {
int r;
_cleanup_strv_free_ char **l = NULL;
int r;
_cleanup_strv_free_ char **l = NULL;
- r = load_env_file("/etc/vconsole.conf", NULL, &l);
+ r = load_env_file(
NULL,
"/etc/vconsole.conf", NULL, &l);
if (r < 0 && r != -ENOENT)
return r;
if (r < 0 && r != -ENOENT)
return r;
@@
-532,6
+534,7
@@
static int read_next_mapping(FILE *f, unsigned *n, char ***a) {
for (;;) {
char line[LINE_MAX];
char *l, **b;
for (;;) {
char line[LINE_MAX];
char *l, **b;
+ int r;
errno = 0;
if (!fgets(line, sizeof(line), f)) {
errno = 0;
if (!fgets(line, sizeof(line), f)) {
@@
-548,9
+551,9
@@
static int read_next_mapping(FILE *f, unsigned *n, char ***a) {
if (l[0] == 0 || l[0] == '#')
continue;
if (l[0] == 0 || l[0] == '#')
continue;
-
b = strv_split_quoted(
l);
- if (
!b
)
- return
-ENOMEM
;
+
r = strv_split_quoted(&b,
l);
+ if (
r < 0
)
+ return
r
;
if (strv_length(b) < 5) {
log_error("Invalid line "SYSTEMD_KBD_MODEL_MAP":%u, ignoring.", *n);
if (strv_length(b) < 5) {
log_error("Invalid line "SYSTEMD_KBD_MODEL_MAP":%u, ignoring.", *n);
@@
-848,7
+851,7
@@
static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_
k = strlen(names[p]);
if (startswith(*i, names[p]) &&
(*i)[k] == '=' &&
k = strlen(names[p]);
if (startswith(*i, names[p]) &&
(*i)[k] == '=' &&
-
string_is_safe
((*i) + k + 1)) {
+
locale_is_valid
((*i) + k + 1)) {
valid = true;
passed[p] = true;
valid = true;
passed[p] = true;
@@
-1076,7
+1079,7
@@
static const sd_bus_vtable locale_vtable[] = {
};
static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
};
static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
- _cleanup_bus_unref_ sd_bus *bus = NULL;
+ _cleanup_bus_
close_
unref_ sd_bus *bus = NULL;
int r;
assert(c);
int r;
assert(c);
@@
-1116,7
+1119,7
@@
static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
int main(int argc, char *argv[]) {
Context context = {};
_cleanup_event_unref_ sd_event *event = NULL;
int main(int argc, char *argv[]) {
Context context = {};
_cleanup_event_unref_ sd_event *event = NULL;
- _cleanup_bus_unref_ sd_bus *bus = NULL;
+ _cleanup_bus_
close_
unref_ sd_bus *bus = NULL;
int r;
log_set_target(LOG_TARGET_AUTO);
int r;
log_set_target(LOG_TARGET_AUTO);