]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk, fdisk: add fflush()
authorKarel Zak <kzak@redhat.com>
Thu, 10 Mar 2016 11:26:43 +0000 (12:26 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 10 Mar 2016 11:26:43 +0000 (12:26 +0100)
Let's add fflush(stdout) before we print to stderr to make output
order more deterministic.

Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fdisk.c
disk-utils/sfdisk.c
tests/expected/sfdisk/dos-explicit-size
tests/expected/sfdisk/dos-read-dump
tests/expected/sfdisk/gpt-list-pmbr

index 3aa915b2c02b2f0fdf6c66e838f8c1c89841277c..3f8769d95c823a3107ac7d03d0222f7f03acc208 100644 (file)
@@ -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);
index 3dfdd9e9a2cc8b4d4e63ca22ff84ce2f3402b124..e39037e4ec173f5a33da9ea8b847856a50fc1fb5 100644 (file)
@@ -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);
index d88f0b6879440e4e37355348e0b4240d4917f9ec..9d987bdeaf89e22dc1c444d66d38a14f340c84da 100644 (file)
@@ -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.
index 1c00be647ceca66a445783c903dba22e766e0112..e5e9f71b98e49fa13faf8e527655bbc37cdddc0e 100644 (file)
@@ -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.
index 2a1b14041372dba21181f73592c1311161ec3e85..13a5e69f662723f4ad2a521809b769aaa4801576 100644 (file)
@@ -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.