return bus_log_create_error(r); \
\
return 1; \
- } \
- struct __useless_struct_to_allow_trailing_semicolon__
+ }
#define DEFINE_BUS_APPEND_PARSE(bus_type, parse_func) \
static int bus_append_##parse_func( \
return bus_log_create_error(r); \
\
return 1; \
- } \
- struct __useless_struct_to_allow_trailing_semicolon__
+ }
DEFINE_BUS_APPEND_PARSE("b", parse_boolean);
DEFINE_BUS_APPEND_PARSE("i", ioprio_class_from_string);
return bus_append_safe_atou64(m, field, eq);
return bus_append_parse_size(m, field, eq, 1024);
-
}
if (streq(field, "CPUQuota")) {
return 1;
}
+ if (streq(field, "TemporaryFileSystem")) {
+ const char *p = eq;
+
+ r = sd_bus_message_open_container(m, SD_BUS_TYPE_STRUCT, "sv");
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ r = sd_bus_message_append_basic(m, SD_BUS_TYPE_STRING, field);
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ r = sd_bus_message_open_container(m, 'v', "a(ss)");
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ r = sd_bus_message_open_container(m, 'a', "(ss)");
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ for (;;) {
+ _cleanup_free_ char *word = NULL, *path = NULL;
+ const char *w;
+
+ r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse argument: %m");
+ if (r == 0)
+ break;
+
+ w = word;
+ r = extract_first_word(&w, &path, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse argument: %m");
+ if (r == 0)
+ return log_error("Failed to parse argument: %m");
+
+ r = sd_bus_message_append(m, "(ss)", path, w);
+ if (r < 0)
+ return bus_log_create_error(r);
+ }
+
+ r = sd_bus_message_close_container(m);
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ r = sd_bus_message_close_container(m);
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ r = sd_bus_message_close_container(m);
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ return 1;
+ }
+
return 0;
}
if (val < 0)
return log_error_errno(r, "Invalid status or signal %s in %s: %m", word, field);
- signal = realloc_multiply(signal, sizeof(int), sz_signal + 1);
+ signal = reallocarray(signal, sz_signal + 1, sizeof(int));
if (!signal)
return log_oom();
signal[sz_signal++] = val;
} else {
- status = realloc_multiply(status, sizeof(int), sz_status + 1);
+ status = reallocarray(status, sz_status + 1, sizeof(int));
if (!status)
return log_oom();
if (r < 0)
return r;
- *ret = d;
- d = NULL;
+ *ret = TAKE_PTR(d);
return 0;
}