Compare commits

...

4 Commits

Author SHA1 Message Date
Lennart Poettering df80c98cde
Merge pull request #17549 from yuwata/tiny-fixes
tiny fixes
2020-11-09 16:04:01 +01:00
Yu Watanabe 601844b71d core: reduce scope of variants
Fixes #17543.
2020-11-09 14:40:05 +09:00
Yu Watanabe 291bb0b01c sd-bus: fix possible division by 0
Fixes #17541.
2020-11-09 14:33:19 +09:00
Yu Watanabe 755b35b1aa home: fix copy-and-paste mistake
Fixes #17542.
2020-11-09 14:00:16 +09:00
3 changed files with 8 additions and 6 deletions

View File

@ -5646,9 +5646,7 @@ void unit_dump_config_items(FILE *f) {
NULSTR_FOREACH(i, load_fragment_gperf_nulstr) { NULSTR_FOREACH(i, load_fragment_gperf_nulstr) {
const char *rvalue = "OTHER", *lvalue; const char *rvalue = "OTHER", *lvalue;
const ConfigPerfItem *p; const ConfigPerfItem *p;
size_t prefix_len;
const char *dot; const char *dot;
unsigned j;
assert_se(p = load_fragment_gperf_lookup(i, strlen(i))); assert_se(p = load_fragment_gperf_lookup(i, strlen(i)));
@ -5657,7 +5655,7 @@ void unit_dump_config_items(FILE *f) {
p->ltype == DISABLED_LEGACY) p->ltype == DISABLED_LEGACY)
continue; continue;
for (j = 0; j < ELEMENTSOF(table); j++) for (size_t j = 0; j < ELEMENTSOF(table); j++)
if (p->parse == table[j].callback) { if (p->parse == table[j].callback) {
rvalue = table[j].rvalue; rvalue = table[j].rvalue;
break; break;
@ -5665,15 +5663,17 @@ void unit_dump_config_items(FILE *f) {
dot = strchr(i, '.'); dot = strchr(i, '.');
lvalue = dot ? dot + 1 : i; lvalue = dot ? dot + 1 : i;
prefix_len = dot-i;
if (dot) if (dot) {
size_t prefix_len = dot - i;
if (!prev || !strneq(prev, i, prefix_len+1)) { if (!prev || !strneq(prev, i, prefix_len+1)) {
if (prev) if (prev)
fputc('\n', f); fputc('\n', f);
fprintf(f, "[%.*s]\n", (int) prefix_len, i); fprintf(f, "[%.*s]\n", (int) prefix_len, i);
} }
}
fprintf(f, "%s=%s\n", lvalue, rvalue); fprintf(f, "%s=%s\n", lvalue, rvalue);
prev = i; prev = i;

View File

@ -159,7 +159,7 @@ static int on_home_inotify(sd_event_source *s, const struct inotify_event *event
(void) bus_manager_emit_auto_login_changed(m); (void) bus_manager_emit_auto_login_changed(m);
} }
if ((event->mask & (IN_DELETE|IN_MOVED_FROM|IN_DELETE)) != 0) { if ((event->mask & (IN_DELETE | IN_CLOSE_WRITE | IN_MOVED_FROM)) != 0) {
Home *h; Home *h;
if (FLAGS_SET(event->mask, IN_DELETE)) if (FLAGS_SET(event->mask, IN_DELETE))

View File

@ -3189,6 +3189,8 @@ static int container_next_item(sd_bus_message *m, struct bus_container *c, size_
int sz; int sz;
sz = bus_gvariant_get_size(c->signature); sz = bus_gvariant_get_size(c->signature);
if (sz == 0)
return -EBADMSG;
if (sz < 0) { if (sz < 0) {
int alignment; int alignment;