r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
if (r == -ENOMEM)
return log_oom();
- if (r <= 0 || isempty(p)) {
+ if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to extract device path and weight from '%s', ignoring.", rvalue);
return 0;
}
+ if (r == 0 || isempty(p)) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0,
+ "Invalid device path or weight specified in '%s', ignoring.", rvalue);
+ return 0;
+ }
r = unit_path_printf(userdata, path, &resolved);
if (r < 0) {
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
if (r == -ENOMEM)
return log_oom();
- if (r <= 0 || isempty(p)) {
+ if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to extract device path and latency from '%s', ignoring.", rvalue);
return 0;
}
+ if (r == 0 || isempty(p)) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0,
+ "Invalid device path or latency specified in '%s', ignoring.", rvalue);
+ return 0;
+ }
r = unit_path_printf(userdata, path, &resolved);
if (r < 0) {
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
if (r == -ENOMEM)
return log_oom();
- if (r <= 0 || isempty(p)) {
+ if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to extract device node and bandwidth from '%s', ignoring.", rvalue);
return 0;
}
+ if (r == 0 || isempty(p)) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0,
+ "Invalid device node or bandwidth specified in '%s', ignoring.", rvalue);
+ return 0;
+ }
r = unit_path_printf(userdata, path, &resolved);
if (r < 0) {
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
if (r == -ENOMEM)
return log_oom();
- if (r <= 0 || isempty(p)) {
+ if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to extract device node and weight from '%s', ignoring.", rvalue);
return 0;
}
+ if (r == 0 || isempty(p)) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0,
+ "Invalid device node or weight specified in '%s', ignoring.", rvalue);
+ return 0;
+ }
r = unit_path_printf(userdata, path, &resolved);
if (r < 0) {
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
if (r == -ENOMEM)
return log_oom();
- if (r <= 0 || isempty(p)) {
+ if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to extract device node and bandwidth from '%s', ignoring.", rvalue);
return 0;
}
+ if (r == 0 || isempty(p)) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0,
+ "Invalid device node or bandwidth specified in '%s', ignoring.", rvalue);
+ return 0;
+ }
r = unit_path_printf(userdata, path, &resolved);
if (r < 0) {
r = extract_first_word(&p, &word, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
if (r == -ENOMEM)
return log_oom();
- if (r <= 0 || !p) {
- log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract credential name, ignoring: %s", rvalue);
+ return 0;
+ }
+ if (r == 0 || isempty(p)) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid syntax, ignoring: %s", rvalue);
return 0;
}
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
- log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s: %s", lvalue, rvalue);
+ log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=, ignoring: %s", lvalue, rvalue);
return 0;
}
void *userdata) {
_cleanup_free_ char *resolved = NULL, *word = NULL;
CGroupContext *c = data;
+ const char *p = rvalue;
Unit *u = userdata;
int attach_type, r;
return 0;
}
- r = extract_first_word(&rvalue, &word, ":", 0);
+ r = extract_first_word(&p, &word, ":", 0);
if (r == -ENOMEM)
return log_oom();
- if (r <= 0 || isempty(rvalue)) {
+ if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse foreign BPF program, ignoring: %s", rvalue);
return 0;
}
+ if (r == 0 || isempty(p)) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid syntax in %s=, ignoring: %s", lvalue, rvalue);
+ return 0;
+ }
attach_type = bpf_cgroup_attach_type_from_string(word);
if (attach_type < 0) {
return 0;
}
- r = unit_path_printf(u, rvalue, &resolved);
+ r = unit_path_printf(u, p, &resolved);
if (r < 0) {
- log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to resolve unit specifiers in '%s', ignoring: %m", rvalue);
+ log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to resolve unit specifiers in '%s', ignoring: %s", p, rvalue);
return 0;
}