>From 6006bedd30530a91c2dee7e3822a8840799752e4 Mon Sep 17 00:00:00 2001
From: Didier Roche <didro...@ubuntu.com>
Date: Mon, 26 Jan 2015 16:01:11 +0100
Subject: [PATCH 2/9] systemd-fsck: always connect to systemd-fsckd

Remove the plymouth running or show-status checks from systemd-fsck. Instead,
always connect to systemd-fsckd socket, and let this one decide if we display
progress or not.
---
 src/fsck/fsck.c   | 12 ++++--------
 src/fsckd/fsckd.c |  8 +++++---
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 6ccb2e7..9ecba99 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -45,7 +45,6 @@
 
 static bool arg_skip = false;
 static bool arg_force = false;
-static bool arg_show_progress = false;
 static const char *arg_repair = "-a";
 
 static void start_target(const char *target) {
@@ -131,8 +130,6 @@ static void test_files(void) {
         }
 #endif
 
-        if (access("/run/systemd/show-status", F_OK) >= 0 || plymouth_running())
-                arg_show_progress = true;
 }
 
 static int process_progress(int fd, dev_t device_num) {
@@ -286,11 +283,10 @@ int main(int argc, char *argv[]) {
                         log_warning_errno(r, "fsck.%s cannot be used for %s: %m", type, device);
         }
 
-        if (arg_show_progress)
-                if (pipe(progress_pipe) < 0) {
-                        log_error_errno(errno, "pipe(): %m");
-                        return EXIT_FAILURE;
-                }
+        if (pipe(progress_pipe) < 0) {
+                log_error_errno(errno, "pipe(): %m");
+                return EXIT_FAILURE;
+        }
 
         cmdline[i++] = "/sbin/fsck";
         cmdline[i++] =  arg_repair;
diff --git a/src/fsckd/fsckd.c b/src/fsckd/fsckd.c
index 39fe899..6b2eeb0 100644
--- a/src/fsckd/fsckd.c
+++ b/src/fsckd/fsckd.c
@@ -259,9 +259,11 @@ static int manager_new(Manager **ret, int fd) {
                 return r;
 
         m->connection_fd = fd;
-        m->console = fopen("/dev/console", "we");
-        if (!m->console)
-                return log_warning_errno(errno, "Can't connect to /dev/console: %m");
+        if (access("/run/systemd/show-status", F_OK) >= 0) {
+                m->console = fopen("/dev/console", "we");
+                if (!m->console)
+                        return log_warning_errno(errno, "Can't connect to /dev/console: %m");
+        }
         m->percent = 100;
 
         *ret = m;
-- 
2.1.4

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to