chiark / gitweb /
systemd-fsck: always connect to systemd-fsckd
authorDidier Roche <didrocks@ubuntu.com>
Mon, 26 Jan 2015 15:01:11 +0000 (16:01 +0100)
committerMartin Pitt <martin.pitt@ubuntu.com>
Wed, 18 Feb 2015 15:33:46 +0000 (16:33 +0100)
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
src/fsckd/fsckd.c

index 6ccb2e7340edc521675ffa09a0a7b38badca548b..9ecba99bb1a7b4c28f11d21658412945163709ab 100644 (file)
@@ -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;
index 39fe899b99dec18af08de28a53b4ebcaa3698de6..6b2eeb067f07903d1f374a6f3d6338df78e36b4a 100644 (file)
@@ -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;