From a16834335d745d631d6ee20eef0bdbe24e4b152d Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 26 Mar 2008 08:53:13 -0400 Subject: [PATCH] fsck: Make -Cn work correctly where n != 0 Previously, fsck was only passing in -Cn to the first e2fsck process to start up, and enabling the progress information by sending a SIGUSR1 signal. This didn't work if the progress information was intended to go to file descriptor, since the information was never passed to e2fsck. So we now pass the progress fd in as a negative number if the progress information is intended to be initially suppressed. Addresses-Launchpad-Bug: #203323 Addresses-Sourceforge-Bug: #1926023 Signed-off-by: "Theodore Ts'o" --- misc/fsck.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/misc/fsck.c b/misc/fsck.c index 14d7a954a..e44829ab2 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -451,13 +451,19 @@ static int execute(const char *type, const char *device, const char *mntpt, for (i=0; i flags |= FLAG_PROGRESS; + + tmp[0] = 0; + if (!progress_active()) { + snprintf(tmp, 80, "-C%d", progress_fd); + inst->flags |= FLAG_PROGRESS; + } else if (progress_fd) + snprintf(tmp, 80, "-C%d", progress_fd * -1); + if (tmp[0]) + argv[argc++] = string_copy(tmp); } } -- 2.47.2