diff options
author | Phillip Susi | 2010-03-31 15:52:08 +0200 |
---|---|---|
committer | Karel Zak | 2010-03-31 15:52:08 +0200 |
commit | d6d9cc6ea158ef3b2525742ee3f80c4a3be8b049 (patch) | |
tree | ee899b7d52e4b81a85a6f09f497e0c2083bcc0d4 /partx | |
parent | mkswap: fixed strtoll() usage (diff) | |
download | kernel-qcow2-util-linux-d6d9cc6ea158ef3b2525742ee3f80c4a3be8b049.tar.gz kernel-qcow2-util-linux-d6d9cc6ea158ef3b2525742ee3f80c4a3be8b049.tar.xz kernel-qcow2-util-linux-d6d9cc6ea158ef3b2525742ee3f80c4a3be8b049.zip |
partx: do not add nonexistent partitions
This simple patch fixes partx -a to not add nonexistent zero length
partitions for unused primary partition slots to to the kernel. This
makes partx conform to the usual kernel behavior.
Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'partx')
-rw-r--r-- | partx/partx.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/partx/partx.c b/partx/partx.c index 16ea1fab0..3d60bf697 100644 --- a/partx/partx.c +++ b/partx/partx.c @@ -295,6 +295,9 @@ main(int argc, char **argv){ } } for (j=0; j<n; j++) { + /* skip unused/empty partitions */ + if (slices[j].size == 0) + continue; pt.pno = lower+j; pt.start = 512 * (long long) slices[j].start; pt.length = 512 * (long long) slices[j].size; |