tree-wide: use structured initialization for sockaddr_un
This commit is contained in:
+3
-3
@@ -2815,7 +2815,8 @@ static int setup_sd_notify_child(void) {
|
||||
static const int one = 1;
|
||||
int fd = -1;
|
||||
union sockaddr_union sa = {
|
||||
.sa.sa_family = AF_UNIX,
|
||||
.un.sun_family = AF_UNIX,
|
||||
.un.sun_path = NSPAWN_NOTIFY_SOCKET_PATH,
|
||||
};
|
||||
int r;
|
||||
|
||||
@@ -2826,11 +2827,10 @@ static int setup_sd_notify_child(void) {
|
||||
(void) mkdir_parents(NSPAWN_NOTIFY_SOCKET_PATH, 0755);
|
||||
(void) unlink(NSPAWN_NOTIFY_SOCKET_PATH);
|
||||
|
||||
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);
|
||||
return log_error_errno(errno, "bind(%s) failed: %m", sa.un.sun_path);
|
||||
return log_error_errno(errno, "bind(" NSPAWN_NOTIFY_SOCKET_PATH ") failed: %m");
|
||||
}
|
||||
|
||||
r = userns_lchown(NSPAWN_NOTIFY_SOCKET_PATH, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user