Skip to content

Instantly share code, notes, and snippets.

@lucasdemarchi
Created November 7, 2018 18:11
Show Gist options
  • Save lucasdemarchi/cd092aa30f58e5ff2ccde6ef4b725fce to your computer and use it in GitHub Desktop.
Save lucasdemarchi/cd092aa30f58e5ff2ccde6ef4b725fce to your computer and use it in GitHub Desktop.
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 2b5b6bf374..380f419873 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2778,10 +2778,11 @@ static int setup_sd_notify_child(void) {
if (fd < 0)
return log_error_errno(errno, "Failed to allocate notification socket: %m");
+ strncpy(sa.un.sun_path, NSPAWN_NOTIFY_SOCKET_PATH, sizeof(sa.un.sun_path));
+
(void) mkdir_parents(NSPAWN_NOTIFY_SOCKET_PATH, 0755);
(void) sockaddr_un_unlink(&sa.un);
- strncpy(sa.un.sun_path, NSPAWN_NOTIFY_SOCKET_PATH, sizeof(sa.un.sun_path));
r = bind(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un));
if (r < 0) {
safe_close(fd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment