static int setup_boot_id(const char *dest) {
_cleanup_free_ char *from = NULL, *to = NULL;
sd_id128_t rnd = {};
static int setup_boot_id(const char *dest) {
_cleanup_free_ char *from = NULL, *to = NULL;
sd_id128_t rnd = {};
- snprintf(as_uuid, sizeof(as_uuid),
- "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- SD_ID128_FORMAT_VAL(rnd));
- char_array_0(as_uuid);
+ id128_format_as_uuid(rnd, as_uuid);
/* Store away the fd in the socket, so that it stays open as
* long as we run the child */
k = sendmsg(kmsg_socket, &mh, MSG_DONTWAIT|MSG_NOSIGNAL);
/* Store away the fd in the socket, so that it stays open as
* long as we run the child */
k = sendmsg(kmsg_socket, &mh, MSG_DONTWAIT|MSG_NOSIGNAL);
- r = sd_rtnl_message_append_string(m, IFLA_INFO_KIND, "veth");
- if (r < 0) {
- log_error("Failed to append netlink kind: %s", strerror(-r));
- return r;
- }
-
- r = sd_rtnl_message_open_container(m, IFLA_INFO_DATA);
+ r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "veth");
r = sd_rtnl_message_append_string(m, IFLA_IFNAME, veth_name);
if (r < 0) {
log_error("Failed to add netlink interface name field: %s", strerror(-r));
r = sd_rtnl_message_append_string(m, IFLA_IFNAME, veth_name);
if (r < 0) {
log_error("Failed to add netlink interface name field: %s", strerror(-r));
- r = sd_rtnl_message_append_string(m, IFLA_INFO_KIND, "macvlan");
- if (r < 0) {
- log_error("Failed to append netlink kind: %s", strerror(-r));
- return r;
- }
-
- r = sd_rtnl_message_open_container(m, IFLA_INFO_DATA);
+ r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "macvlan");
if (image_fd && *image_fd >= 0) {
ioctl(*image_fd, LOOP_CLR_FD);
if (image_fd && *image_fd >= 0) {
ioctl(*image_fd, LOOP_CLR_FD);
char line[LINE_MAX], *w, *x, *state, *u, *g, *h;
_cleanup_free_ uid_t *uids = NULL;
_cleanup_free_ char *home = NULL;
_cleanup_fclose_ FILE *f = NULL;
_cleanup_close_ int fd = -1;
unsigned n_uids = 0;
char line[LINE_MAX], *w, *x, *state, *u, *g, *h;
_cleanup_free_ uid_t *uids = NULL;
_cleanup_free_ char *home = NULL;
_cleanup_fclose_ FILE *f = NULL;
_cleanup_close_ int fd = -1;
unsigned n_uids = 0;
_cleanup_free_ char *kdbus_domain = NULL, *device_path = NULL, *root_device = NULL, *home_device = NULL, *srv_device = NULL;
bool root_device_rw = true, home_device_rw = true, srv_device_rw = true;
_cleanup_close_ int master = -1, kdbus_fd = -1, image_fd = -1;
_cleanup_free_ char *kdbus_domain = NULL, *device_path = NULL, *root_device = NULL, *home_device = NULL, *srv_device = NULL;
bool root_device_rw = true, home_device_rw = true, srv_device_rw = true;
_cleanup_close_ int master = -1, kdbus_fd = -1, image_fd = -1;
_cleanup_fdset_free_ FDSet *fds = NULL;
int r = EXIT_FAILURE, k, n_fd_passed, loop_nr = -1;
const char *console = NULL;
_cleanup_fdset_free_ FDSet *fds = NULL;
int r = EXIT_FAILURE, k, n_fd_passed, loop_nr = -1;
const char *console = NULL;
close_nointr(STDIN_FILENO);
close_nointr(STDOUT_FILENO);
close_nointr(STDERR_FILENO);
close_nointr(STDIN_FILENO);
close_nointr(STDOUT_FILENO);
close_nointr(STDERR_FILENO);
* it can cgroupify us to that we lack access
* to certain devices and resources. */
eventfd_write(child_ready_fd, 1);
* it can cgroupify us to that we lack access
* to certain devices and resources. */
eventfd_write(child_ready_fd, 1);
if (chdir(arg_directory) < 0) {
log_error("chdir(%s) failed: %m", arg_directory);
if (chdir(arg_directory) < 0) {
log_error("chdir(%s) failed: %m", arg_directory);
- if (asprintf((char**)(envp + n_env++), "container_uuid=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(arg_uuid)) < 0) {
+ char as_uuid[37];
+
+ if (asprintf((char**)(envp + n_env++), "container_uuid=%s", id128_format_as_uuid(arg_uuid, as_uuid)) < 0) {
/* Wait until the parent is ready with the setup, too... */
eventfd_read(parent_ready_fd, &x);
/* Wait until the parent is ready with the setup, too... */
eventfd_read(parent_ready_fd, &x);
* the notification we can make the process join its
* cgroup which might limit what it can do */
eventfd_read(child_ready_fd, &x);
* the notification we can make the process join its
* cgroup which might limit what it can do */
eventfd_read(child_ready_fd, &x);