summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak2012-05-23 11:24:04 +0200
committerKarel Zak2012-05-23 11:24:04 +0200
commit7657d3e217edd89f220fef4008aafd4a7a970193 (patch)
tree17170fdfbeaa01ad8d2f1084452920ecac7d8ad1 /fdisk/fdisk.c
parentfdisk: always use stderr for debug messages (diff)
downloadkernel-qcow2-util-linux-7657d3e217edd89f220fef4008aafd4a7a970193.tar.gz
kernel-qcow2-util-linux-7657d3e217edd89f220fef4008aafd4a7a970193.tar.xz
kernel-qcow2-util-linux-7657d3e217edd89f220fef4008aafd4a7a970193.zip
fdisk: add readonly option to fdisk_new_context_from_filename()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r--fdisk/fdisk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index aac41a1ed..e5cc90ede 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -1927,7 +1927,7 @@ print_partition_table_from_option(char *device)
{
int gb;
- cxt = fdisk_new_context_from_filename(device);
+ cxt = fdisk_new_context_from_filename(device, 1); /* read-only */
if (!cxt)
err(EXIT_FAILURE, _("unable to open %s"), device);
@@ -1941,6 +1941,7 @@ print_partition_table_from_option(char *device)
else if (!gb)
list_table(0);
fdisk_free_context(cxt);
+ cxt = NULL;
}
/*
@@ -2203,7 +2204,7 @@ int main(int argc, char **argv)
}
if (argc-optind == 1) {
- cxt = fdisk_new_context_from_filename(argv[optind]);
+ cxt = fdisk_new_context_from_filename(argv[optind], 0);
if (!cxt)
err(EXIT_FAILURE, _("unable to open %s"), argv[optind]);
}