return 0;
}
+static char* id128_format_as_uuid(sd_id128_t id, char s[37]) {
+
+ snprintf(s, 37,
+ "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ SD_ID128_FORMAT_VAL(id));
+
+ return s;
+}
+
static int setup_boot_id(const char *dest) {
_cleanup_free_ char *from = NULL, *to = NULL;
sd_id128_t rnd = {};
return r;
}
- 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);
r = write_string_file(from, as_uuid);
if (r < 0) {
return r;
}
- 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");
if (r < 0) {
log_error("Failed to open netlink container: %s", strerror(-r));
return r;
return 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 (r < 0) {
log_error("Failed to open netlink container: %s", strerror(-r));
return r;
_cleanup_fclose_ FILE *f = NULL;
_cleanup_close_ int fd = -1;
unsigned n_uids = 0;
- size_t sz, l;
+ size_t sz = 0, l;
uid_t uid;
gid_t gid;
pid_t pid;
}
if (!sd_id128_equal(arg_uuid, SD_ID128_NULL)) {
- 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) {
log_oom();
goto child_fail;
}
fds = NULL;
/* Wait until the child reported that it is ready with
- * all it needs to do with priviliges. After we got
+ * all it needs to do with privileges. After we got
* the notification we can make the process join its
* cgroup which might limit what it can do */
eventfd_read(child_ready_fd, &x);