static int open_un_socket_and_connect(void)
{
- struct sockaddr_un su = { /* The abstract UNIX socket of plymouth */
+ /* The abstract UNIX socket of plymouth */
+ struct sockaddr_un su = {
.sun_family = AF_UNIX,
.sun_path = PLYMOUTH_SOCKET_PATH,
};
goto err;
}
- ret = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, (socklen_t)sizeof(one));
+ ret = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one));
if (ret < 0) {
warnx(_("cannot set option for UNIX socket"));
close(fd);
goto err;
}
- /*
- * Please note that the PLYMOUTH_SOCKET_PATH has a
- * leading NULL byte to mark it as an abstract socket
- */
- ret = connect(fd, (const struct sockaddr *) &su,
- offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
+ /* Note, the abstract PLYMOUTH_SOCKET_PATH has a leading NULL byte */
+ ret = connect(fd, (struct sockaddr *) &su,
+ offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
if (ret < 0) {
if (errno != ECONNREFUSED)
warnx(_("cannot connect on UNIX socket"));
sp.sa_flags = SA_RESTART;
sigaction(SIGPIPE, &sp, &op);
- /*
- * The plymouthd does read at least two bytes.
- */
+ /* The plymouthd does read at least two bytes. */
command[1] = '\0';
switch (cmd) {
case MAGIC_PING: