/* Otherwise, add to the list */
r = manager_parse_dns_server_string_and_warn(m, ltype, rvalue);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse DNS server string '%s'. Ignoring.", rvalue);
+ log_syntax(unit, LOG_WARNING, filename, line, r,
+ "Failed to parse DNS server string '%s', ignoring.", rvalue);
return 0;
}
}
/* Otherwise, add to the list */
r = manager_parse_search_domains_and_warn(m, rvalue);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse search domains string '%s'. Ignoring.", rvalue);
+ log_syntax(unit, LOG_WARNING, filename, line, r,
+ "Failed to parse search domains string '%s', ignoring.", rvalue);
return 0;
}
}
return 0;
}
-int config_parse_dnssd_service_type(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata) {
+int config_parse_dnssd_service_type(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
DnssdService *s = userdata;
int r;
assert(s);
if (isempty(rvalue)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Service type can't be empty. Ignoring.");
- return -EINVAL;
+ s->type = mfree(s->type);
+ return 0;
}
if (!dnssd_srv_type_is_valid(rvalue)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Service type is invalid. Ignoring.");
- return -EINVAL;
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Service type is invalid. Ignoring.");
+ return 0;
}
r = free_and_strdup(&s->type, rvalue);
return 0;
}
-int config_parse_dnssd_txt(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata) {
+int config_parse_dnssd_txt(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
_cleanup_(dnssd_txtdata_freep) DnssdTxtData *txt_data = NULL;
DnssdService *s = userdata;
DnsTxtItem *last = NULL;
return log_oom();
for (;;) {
- _cleanup_free_ char *word = NULL;
- _cleanup_free_ char *key = NULL;
- _cleanup_free_ char *value = NULL;
+ _cleanup_free_ char *word = NULL, *key = NULL, *value = NULL;
_cleanup_free_ void *decoded = NULL;
size_t length = 0;
DnsTxtItem *i;
break;
if (r == -ENOMEM)
return log_oom();
- if (r < 0)
- return log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
+ return 0;
+ }
r = split_pair(word, "=", &key, &value);
if (r == -ENOMEM)
key = TAKE_PTR(word);
if (!ascii_is_valid(key)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid syntax, ignoring: %s", key);
- return -EINVAL;
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid key, ignoring: %s", key);
+ continue;
}
switch (ltype) {
r = unbase64mem(value, strlen(value), &decoded, &length);
if (r == -ENOMEM)
return log_oom();
- if (r < 0)
- return log_syntax(unit, LOG_ERR, filename, line, r,
- "Invalid base64 encoding, ignoring: %s", value);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r,
+ "Invalid base64 encoding, ignoring: %s", value);
+ continue;
+ }
}
r = dnssd_txt_item_new_from_data(key, decoded, length, &i);
if (!LIST_IS_EMPTY(txt_data->txt)) {
LIST_PREPEND(items, s->txt_data_items, txt_data);
- txt_data = NULL;
+ TAKE_PTR(txt_data);
}
return 0;