summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/dos.c
diff options
context:
space:
mode:
authorKarel Zak2017-08-22 14:54:27 +0200
committerKarel Zak2017-08-22 14:54:27 +0200
commit980cc4a18219972ad126beb391f6f25a07730aaa (patch)
treeb580f541777f7c14199632a25ea99b820d43ef00 /libfdisk/src/dos.c
parentlibfdisk: improve "add partition" debug message (diff)
downloadkernel-qcow2-util-linux-980cc4a18219972ad126beb391f6f25a07730aaa.tar.gz
kernel-qcow2-util-linux-980cc4a18219972ad126beb391f6f25a07730aaa.tar.xz
kernel-qcow2-util-linux-980cc4a18219972ad126beb391f6f25a07730aaa.zip
libfdisk: (dos) use size-=1 when alignment not used later
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/dos.c')
-rw-r--r--libfdisk/src/dos.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 6fa9108ed..1e0480ea1 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -1196,7 +1196,7 @@ static int add_partition(struct fdisk_context *cxt, size_t n,
else if (pa && fdisk_partition_has_size(pa)) {
stop = start + pa->size;
isrel = pa->size_explicit ? 0 : 1;
- if (!isrel && stop > start)
+ if ((!isrel || !alignment_required(cxt)) && stop > start)
stop -= 1;
} else {
/* ask user by dialog */
@@ -1242,7 +1242,7 @@ static int add_partition(struct fdisk_context *cxt, size_t n,
}
}
- DBG(LABEL, ul_debug("DOS: raw stop: %ju", (uintmax_t) stop));
+ DBG(LABEL, ul_debug("DOS: raw stop: %ju [limit %ju]", (uintmax_t) stop, (uintmax_t) limit));
if (stop > limit)
stop = limit;
@@ -1252,7 +1252,7 @@ static int add_partition(struct fdisk_context *cxt, size_t n,
isrel = 0;
if (stop > start)
stop -= 1;
- DBG(LABEL, ul_debug("DOS: don't align end os tiny partition [start=%ju, stop=%ju, grain=%lu]",
+ DBG(LABEL, ul_debug("DOS: don't align end of tiny partition [start=%ju, stop=%ju, grain=%lu]",
(uintmax_t)start, (uintmax_t)stop, cxt->grain));
}