diff options
author | Karel Zak | 2014-07-15 12:28:16 +0200 |
---|---|---|
committer | Karel Zak | 2014-07-15 12:32:03 +0200 |
commit | bc787727d4a114d5f8926fb9c22fb11c40d1d8c0 (patch) | |
tree | 83bd407eb22b1f770cee7841ec82d8215e38f070 /disk-utils/cfdisk.c | |
parent | docs: fix name and URL of 2.25-rc1 (diff) | |
download | kernel-qcow2-util-linux-bc787727d4a114d5f8926fb9c22fb11c40d1d8c0.tar.gz kernel-qcow2-util-linux-bc787727d4a114d5f8926fb9c22fb11c40d1d8c0.tar.xz kernel-qcow2-util-linux-bc787727d4a114d5f8926fb9c22fb11c40d1d8c0.zip |
libfdisk: make disk sync() optional
... this allows to avoid unnecessary sync() from cfdisk.
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/cfdisk.c')
-rw-r--r-- | disk-utils/cfdisk.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index fb089f580..8a627e52e 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -148,6 +148,8 @@ struct cfdisk { size_t lines_idx; /* current line <0..N>, exclude header */ size_t page_sz; + unsigned int nwrites; /* fdisk_write_disklabel() counter */ + unsigned int wrong_order :1, /* PT not in right order */ zero_start :1; /* ignore existing partition table */ }; @@ -1805,6 +1807,7 @@ static int main_menu_action(struct cfdisk *cf, int key) fdisk_reread_partition_table(cf->cxt); info = _("The partition table has been altered."); } + cf->nwrites++; break; } default: @@ -2019,7 +2022,7 @@ int main(int argc, char *argv[]) free(cf->linesbuf); fdisk_unref_table(cf->table); - rc = fdisk_context_deassign_device(cf->cxt); + rc = fdisk_context_deassign_device(cf->cxt, cf->nwrites == 0); fdisk_free_context(cf->cxt); DBG(FRONTEND, ul_debug("bye! [rc=%d]", rc)); return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE; |