diff options
author | Karel Zak | 2016-03-10 12:26:43 +0100 |
---|---|---|
committer | Karel Zak | 2016-03-10 12:26:43 +0100 |
commit | 95aae4fcee79958f56c77b934fcbb048ae25f6fb (patch) | |
tree | 3ed4022a8747a8165ba3e48788c57f36bc244520 | |
parent | libmount: Typo fix (diff) | |
download | kernel-qcow2-util-linux-95aae4fcee79958f56c77b934fcbb048ae25f6fb.tar.gz kernel-qcow2-util-linux-95aae4fcee79958f56c77b934fcbb048ae25f6fb.tar.xz kernel-qcow2-util-linux-95aae4fcee79958f56c77b934fcbb048ae25f6fb.zip |
sfdisk, fdisk: add fflush()
Let's add fflush(stdout) before we print to stderr to make output
order more deterministic.
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | disk-utils/fdisk.c | 2 | ||||
-rw-r--r-- | disk-utils/sfdisk.c | 2 | ||||
-rw-r--r-- | tests/expected/sfdisk/dos-explicit-size | 14 | ||||
-rw-r--r-- | tests/expected/sfdisk/dos-read-dump | 4 | ||||
-rw-r--r-- | tests/expected/sfdisk/gpt-list-pmbr | 2 |
5 files changed, 14 insertions, 10 deletions
diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 3aa915b2c..3f8769d95 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -367,12 +367,14 @@ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask, fputs_info(ask, stdout); break; case FDISK_ASKTYPE_WARNX: + fflush(stdout); color_scheme_fenable("warn", UL_COLOR_RED, stderr); fputs(fdisk_ask_print_get_mesg(ask), stderr); color_fdisable(stderr); fputc('\n', stderr); break; case FDISK_ASKTYPE_WARN: + fflush(stdout); color_scheme_fenable("warn", UL_COLOR_RED, stderr); fputs(fdisk_ask_print_get_mesg(ask), stderr); errno = fdisk_ask_print_get_errno(ask); diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index 3dfdd9e9a..e39037e4e 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -172,12 +172,14 @@ static int ask_callback(struct fdisk_context *cxt __attribute__((__unused__)), fputc('\n', stdout); break; case FDISK_ASKTYPE_WARNX: + fflush(stdout); color_scheme_fenable("warn", UL_COLOR_RED, stderr); fputs(fdisk_ask_print_get_mesg(ask), stderr); color_fdisable(stderr); fputc('\n', stderr); break; case FDISK_ASKTYPE_WARN: + fflush(stdout); color_scheme_fenable("warn", UL_COLOR_RED, stderr); fputs(fdisk_ask_print_get_mesg(ask), stderr); errno = fdisk_ask_print_get_errno(ask); diff --git a/tests/expected/sfdisk/dos-explicit-size b/tests/expected/sfdisk/dos-explicit-size index d88f0b687..9d987bdea 100644 --- a/tests/expected/sfdisk/dos-explicit-size +++ b/tests/expected/sfdisk/dos-explicit-size @@ -1,10 +1,3 @@ -Partition 1 does not start on physical sector boundary. -Partition 2 does not start on physical sector boundary. -Partition 3 does not start on physical sector boundary. -Partition 4 does not start on physical sector boundary. -Partition 5 does not start on physical sector boundary. -Partition 6 does not start on physical sector boundary. -Partition 7 does not start on physical sector boundary. Checking that no-one is using this disk right now ... OK Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors @@ -33,6 +26,13 @@ Device Boot Start End Sectors Size Id Type <removed>6 4003 5002 1000 500K 83 Linux <removed>7 5004 102399 97396 47.6M 83 Linux +Partition 1 does not start on physical sector boundary. +Partition 2 does not start on physical sector boundary. +Partition 3 does not start on physical sector boundary. +Partition 4 does not start on physical sector boundary. +Partition 5 does not start on physical sector boundary. +Partition 6 does not start on physical sector boundary. +Partition 7 does not start on physical sector boundary. The partition table has been altered. Calling ioctl() to re-read partition table. diff --git a/tests/expected/sfdisk/dos-read-dump b/tests/expected/sfdisk/dos-read-dump index 1c00be647..e5e9f71b9 100644 --- a/tests/expected/sfdisk/dos-read-dump +++ b/tests/expected/sfdisk/dos-read-dump @@ -1,5 +1,3 @@ -Partition 5 does not start on physical sector boundary. -Partition 6 does not start on physical sector boundary. Checking that no-one is using this disk right now ... OK Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors @@ -27,6 +25,8 @@ Device Boot Start End Sectors Size Id Type <removed>5 20481 26624 6144 3M 83 Linux <removed>6 26626 102399 75774 37M 83 Linux +Partition 5 does not start on physical sector boundary. +Partition 6 does not start on physical sector boundary. The partition table has been altered. Calling ioctl() to re-read partition table. diff --git a/tests/expected/sfdisk/gpt-list-pmbr b/tests/expected/sfdisk/gpt-list-pmbr index 2a1b14041..13a5e69f6 100644 --- a/tests/expected/sfdisk/gpt-list-pmbr +++ b/tests/expected/sfdisk/gpt-list-pmbr @@ -1,4 +1,3 @@ -Partition 1 does not start on physical sector boundary. Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes @@ -9,3 +8,4 @@ Disk identifier: <removed> Device Boot Start End Sectors Size Id Type <removed>1 1 102399 102399 50M ee GPT +Partition 1 does not start on physical sector boundary. |