X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Fload-fragment.c;h=07384d3668d056219bfa98b428c7f186db2739f1;hp=eea415883b53ada8ccd0456c8ff90719c71321e0;hb=d3f86679783aee216d60b125acfb5f39a0df555f;hpb=b02cb41c78c61c27bf1432e19f241a3c3d47a419 diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index eea415883..07384d366 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -21,26 +21,18 @@ ***/ #include -#include #include #include -#include #include #include -#include -#include #include #include -#include #include -#include -#include #ifdef HAVE_SECCOMP #include #endif -#include "sd-messages.h" #include "unit.h" #include "strv.h" #include "conf-parser.h" @@ -381,7 +373,7 @@ int config_parse_socket_listen(const char *unit, } if (socket_address_family(&p->address) != AF_LOCAL && p->address.type == SOCK_SEQPACKET) { - log_syntax(unit, LOG_ERR, filename, line, ENOTSUP, + log_syntax(unit, LOG_ERR, filename, line, EOPNOTSUPP, "Address family not supported, ignoring: %s", rvalue); return 0; } @@ -589,7 +581,8 @@ int config_parse_exec(const char *unit, } found: - n = new(char*, k + !separate_argv0); + /* If separate_argv0, we'll move first element to path variable */ + n = new(char*, MAX(k + !separate_argv0, 1u)); if (!n) return log_oom(); @@ -633,8 +626,6 @@ int config_parse_exec(const char *unit, n[k] = NULL; - log_debug("path: %s", path ?: n[0]); - if (!n[0]) reason = "Empty executable name or zeroeth argument"; else if (!string_is_safe(path ?: n[0])) @@ -2297,7 +2288,7 @@ int config_parse_documentation(const char *unit, for (a = b = u->documentation; a && *a; a++) { - if (is_valid_documentation_url(*a)) + if (documentation_url_is_valid(*a)) *(b++) = *a; else { log_syntax(unit, LOG_ERR, filename, line, EINVAL, @@ -3149,6 +3140,7 @@ int config_parse_set_status( FOREACH_WORD(word, l, rvalue, state) { _cleanup_free_ char *temp; int val; + Set **set; temp = strndup(word, l); if (!temp) @@ -3161,21 +3153,23 @@ int config_parse_set_status( if (val <= 0) { log_syntax(unit, LOG_ERR, filename, line, -val, "Failed to parse value, ignoring: %s", word); - return 0; + continue; } + set = &status_set->signal; } else { if (val < 0 || val > 255) { log_syntax(unit, LOG_ERR, filename, line, ERANGE, "Value %d is outside range 0-255, ignoring", val); continue; } + set = &status_set->status; } - r = set_ensure_allocated(&status_set->status, NULL); + r = set_ensure_allocated(set, NULL); if (r < 0) return log_oom(); - r = set_put(status_set->status, INT_TO_PTR(val)); + r = set_put(*set, INT_TO_PTR(val)); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, -r, "Unable to store: %s", word); @@ -3436,9 +3430,8 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) { f = fdopen(fd, "re"); if (!f) { - r = -errno; safe_close(fd); - return r; + return -errno; } *_f = f;