mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-24 02:03:54 +03:00
commit
2c80779e33
@ -1255,6 +1255,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
};
|
||||
|
||||
int c, r;
|
||||
const char *p;
|
||||
bool type_a, type_b;
|
||||
|
||||
assert(argc >= 0);
|
||||
@ -1415,18 +1416,21 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
case ARG_GNUTLS_LOG: {
|
||||
#ifdef HAVE_GNUTLS
|
||||
const char *word, *state;
|
||||
size_t size;
|
||||
p = optarg;
|
||||
for (;;) {
|
||||
_cleanup_free_ char *word = NULL;
|
||||
|
||||
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {
|
||||
char *cat;
|
||||
r = extract_first_word(&p, &word, ",", 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to parse --gnutls-log= argument: %m");
|
||||
|
||||
cat = strndup(word, size);
|
||||
if (!cat)
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
if (strv_push(&arg_gnutls_log, word) < 0)
|
||||
return log_oom();
|
||||
|
||||
if (strv_consume(&arg_gnutls_log, cat) < 0)
|
||||
return log_oom();
|
||||
word = NULL;
|
||||
}
|
||||
break;
|
||||
#else
|
||||
|
@ -387,6 +387,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
};
|
||||
|
||||
int c, r;
|
||||
const char *p;
|
||||
uint64_t plus = 0, minus = 0;
|
||||
bool mask_all_settings = false, mask_no_settings = false;
|
||||
|
||||
@ -524,15 +525,16 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
case ARG_CAPABILITY:
|
||||
case ARG_DROP_CAPABILITY: {
|
||||
const char *state, *word;
|
||||
size_t length;
|
||||
p = optarg;
|
||||
for(;;) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
FOREACH_WORD_SEPARATOR(word, length, optarg, ",", state) {
|
||||
_cleanup_free_ char *t;
|
||||
r = extract_first_word(&p, &t, ",", 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to parse capability %s.", t);
|
||||
|
||||
t = strndup(word, length);
|
||||
if (!t)
|
||||
return log_oom();
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
if (streq(t, "all")) {
|
||||
if (c == ARG_CAPABILITY)
|
||||
|
@ -929,8 +929,6 @@ static int config_parse_also(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
size_t l;
|
||||
const char *word, *state;
|
||||
InstallContext *c = data;
|
||||
UnitFileInstallInfo *i = userdata;
|
||||
|
||||
@ -938,13 +936,18 @@ static int config_parse_also(
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
|
||||
FOREACH_WORD_QUOTED(word, l, rvalue, state) {
|
||||
_cleanup_free_ char *n;
|
||||
for(;;) {
|
||||
_cleanup_free_ char *n = NULL;
|
||||
int r;
|
||||
|
||||
n = strndup(word, l);
|
||||
if (!n)
|
||||
return -ENOMEM;
|
||||
r = extract_first_word(&rvalue, &n, NULL, 0);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse config %s, ignoring.", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
r = install_info_add(c, n, NULL);
|
||||
if (r < 0)
|
||||
@ -954,8 +957,6 @@ static int config_parse_also(
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
if (!isempty(state))
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user