+ strempty(arg_directory));
+ if (r < 0) {
+ log_error("Failed to append message arguments: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_bus_message_open_container(m, 'a', "(sv)");
+ if (r < 0) {
+ log_error("Failed to open container: %s", strerror(-r));
+ return r;
+ }
+
+ if (!isempty(arg_slice)) {
+ r = sd_bus_message_append(m, "(sv)", "Slice", "s", arg_slice);
+ if (r < 0) {
+ log_error("Failed to append slice: %s", strerror(-r));
+ return r;
+ }
+ }
+
+ r = sd_bus_message_append(m, "(sv)", "DevicePolicy", "s", "strict");
+ if (r < 0) {
+ log_error("Failed to add device policy: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_bus_message_append(m, "(sv)", "DeviceAllow", "a(ss)", 8,
+ /* Allow the container to
+ * access and create the API
+ * device nodes, so that
+ * PrivateDevices= in the
+ * container can work
+ * fine */
+ "/dev/null", "rwm",
+ "/dev/zero", "rwm",
+ "/dev/full", "rwm",
+ "/dev/random", "rwm",
+ "/dev/urandom", "rwm",
+ "/dev/tty", "rwm",
+ /* Allow the container
+ * access to ptys. However,
+ * do not permit the
+ * container to ever create
+ * these device nodes. */
+ "/dev/pts/ptmx", "rw",
+ "char-pts", "rw");
+ if (r < 0) {
+ log_error("Failed to add device whitelist: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_bus_message_close_container(m);
+ if (r < 0) {
+ log_error("Failed to close container: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_bus_call(bus, m, 0, &error, NULL);