summaryrefslogtreecommitdiff
path: root/src/fsckd
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-03-09 18:19:23 +0100
committerLennart Poettering <lennart@poettering.net>2015-03-09 18:19:23 +0100
commit76bb3afd811ea33fcd20b278fe04ff0a7be203fd (patch)
treea6781055f164f3a442d5c9e5a5d1f7fa7646a0b9 /src/fsckd
parentadfe5671ef794099068038dfccbf1eb5134433c8 (diff)
fsck: simplification
Diffstat (limited to 'src/fsckd')
-rw-r--r--src/fsckd/fsckd.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/fsckd/fsckd.c b/src/fsckd/fsckd.c
index d4e9896e91..0f647468dd 100644
--- a/src/fsckd/fsckd.c
+++ b/src/fsckd/fsckd.c
@@ -252,20 +252,22 @@ static int connect_plymouth(Manager *m) {
int r;
/* try to connect or reconnect if sending a message */
- if (m->plymouth_fd <= 0) {
- m->plymouth_fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
- if (m->plymouth_fd < 0) {
- return log_warning_errno(errno, "Connection to plymouth socket failed: %m");
- }
- if (connect(m->plymouth_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
- on_plymouth_disconnect(m);
- return log_warning_errno(errno, "Couldn't connect to plymouth: %m");
- }
- r = sd_event_add_io(m->event, NULL, m->plymouth_fd, EPOLLIN, plymouth_feedback_handler, m);
- if (r < 0) {
- on_plymouth_disconnect(m);
- return log_warning_errno(r, "Can't listen to plymouth socket: %m");
- }
+ if (m->plymouth_fd >= 0)
+ return 0;
+
+ m->plymouth_fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
+ if (m->plymouth_fd < 0)
+ return log_warning_errno(errno, "Connection to plymouth socket failed: %m");
+
+ if (connect(m->plymouth_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
+ on_plymouth_disconnect(m);
+ return log_warning_errno(errno, "Couldn't connect to plymouth: %m");
+ }
+
+ r = sd_event_add_io(m->event, NULL, m->plymouth_fd, EPOLLIN, plymouth_feedback_handler, m);
+ if (r < 0) {
+ on_plymouth_disconnect(m);
+ return log_warning_errno(r, "Can't listen to plymouth socket: %m");
}
return 0;