From db981e3e0da2b872071f5299e0b4dc4067553040 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Thu, 8 Jun 2017 22:29:32 +0200 Subject: lib: style cosmetics plymouth-ctrl.c Signed-off-by: Ruediger Meier --- lib/plymouth-ctrl.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lib/plymouth-ctrl.c') diff --git a/lib/plymouth-ctrl.c b/lib/plymouth-ctrl.c index 0e60341a1..2d3deda07 100644 --- a/lib/plymouth-ctrl.c +++ b/lib/plymouth-ctrl.c @@ -60,7 +60,8 @@ static int can_read(int fd, const long timeout) 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, }; @@ -73,7 +74,7 @@ static int open_un_socket_and_connect(void) 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); @@ -81,12 +82,9 @@ static int open_un_socket_and_connect(void) 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")); @@ -109,9 +107,7 @@ int plymouth_command(int cmd, ...) 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: -- cgit v1.2.3-55-g7522