diff options
author | Karel Zak | 2014-03-21 14:04:59 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-21 14:04:59 +0100 |
commit | e146ae4edb52b0559cbb42717338665c6395b56f (patch) | |
tree | 95f86c65e0c0f4d1eed1940b92a955be838dc670 /libfdisk/src/label.c | |
parent | libfdisk: clean up debug output (diff) | |
download | kernel-qcow2-util-linux-e146ae4edb52b0559cbb42717338665c6395b56f.tar.gz kernel-qcow2-util-linux-e146ae4edb52b0559cbb42717338665c6395b56f.tar.xz kernel-qcow2-util-linux-e146ae4edb52b0559cbb42717338665c6395b56f.zip |
libfdisk: properly implement read-only mode
Don't use fallback to read-only mode in fdisk_context_assign_device(),
it's application responsibility open the device in the right mode.
The commands fdisk and cfdisk check (and report) read-only mode now.
Reported-by: Maciej MaĆecki <me@mmalecki.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/label.c')
-rw-r--r-- | libfdisk/src/label.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c index 360089972..9c6fcc5b3 100644 --- a/libfdisk/src/label.c +++ b/libfdisk/src/label.c @@ -75,11 +75,10 @@ int fdisk_dev_is_disklabel(struct fdisk_context *cxt, enum fdisk_labeltype l) */ int fdisk_write_disklabel(struct fdisk_context *cxt) { - if (!cxt || !cxt->label) + if (!cxt || !cxt->label || cxt->readonly) return -EINVAL; if (!cxt->label->op->write) return -ENOSYS; - return cxt->label->op->write(cxt); } |