>From feb8f332313c3ac2542f618028f8a6a6a36daf50 Mon Sep 17 00:00:00 2001
From: Didier Roche <[email protected]>
Date: Mon, 26 Jan 2015 16:01:11 +0100
Subject: [PATCH 03/12] 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 | 12 ++++++++++--
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 91dff5c..f5dd546 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -46,7 +46,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) {
@@ -132,8 +131,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) {
@@ -293,11 +290,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 3059c68..e27cd6d 100644
--- a/src/fsckd/fsckd.c
+++ b/src/fsckd/fsckd.c
@@ -45,6 +45,8 @@
#define IDLE_TIME_MINUTES 1
+static bool show_progress = false;
+
typedef struct Clients {
int fd;
char device[PATH_MAX];
@@ -155,8 +157,10 @@ static int handle_requests(int socket_fd) {
numdevices, percent);
/* write to console */
- fprintf(console, "\r%s\r%n", console_message, &m);
- fflush(console);
+ if (show_progress) {
+ fprintf(console, "\r%s\r%n", console_message, &m);
+ fflush(console);
+ }
if (m > clear)
clear = m;
@@ -291,5 +295,9 @@ int main(int argc, char *argv[]) {
if (fd <= 0)
return EXIT_FAILURE;
}
+
+ if (access("/run/systemd/show-status", F_OK) >= 0)
+ show_progress = true;
+
return handle_requests(fd) < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
--
2.1.4
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel