diff options
author | Karel Zak | 2019-02-18 12:34:11 +0100 |
---|---|---|
committer | Karel Zak | 2019-02-18 12:35:33 +0100 |
commit | 1882b3a617e3e609021297cb6e35eb726ae73d33 (patch) | |
tree | f8b4cbfceca11e5fc79d777df8de2432072101c7 /libfdisk/src | |
parent | libsmartcols: use list_add_tail() in more robust way (diff) | |
download | kernel-qcow2-util-linux-1882b3a617e3e609021297cb6e35eb726ae73d33.tar.gz kernel-qcow2-util-linux-1882b3a617e3e609021297cb6e35eb726ae73d33.tar.xz kernel-qcow2-util-linux-1882b3a617e3e609021297cb6e35eb726ae73d33.zip |
libfdisk: use list_add_tail() in more robust way
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src')
-rw-r--r-- | libfdisk/src/table.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libfdisk/src/table.c b/libfdisk/src/table.c index 4881db68e..7718daebb 100644 --- a/libfdisk/src/table.c +++ b/libfdisk/src/table.c @@ -225,6 +225,9 @@ int fdisk_table_add_partition(struct fdisk_table *tb, struct fdisk_partition *pa if (!tb || !pa) return -EINVAL; + if (!list_empty(&pa->parts)) + return -EBUSY; + fdisk_ref_partition(pa); list_add_tail(&pa->parts, &tb->parts); tb->nents++; |