libfdisk: fix add_logical() assert

The zero index is absolutely valid for extended partition (it means
extended partition could be the first partition on the device).

Reported-by: Christoph Hoopmann <christophhoopmann@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
losetup: improve man page -D docs

Signed-off-by: Karel Zak <kzak@redhat.com>
flock: zero timeout is valid

This patch reverts Sami's "timeout cannot be zero", introduced
in commit 605325b23b36238c8f3ae165e37cab9064553cf7.

The --timeout 0 has been originally interpreted as --nonblock. The
patch also add hint about this behavior to the man page.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1149974
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: zeroize errno on blkid_probe_get_buffer() success

Since 37f4060225df0591ab8e1dd676dbc8115d900d4f prober functions are
sensitive to errno, it seems more robust to set errno=0 with in
blkid_probe_get_buffer() on success than set the zero on all places
where we call blkid_probe_get_buffer().

Addresses: https://github.com/karelzak/util-linux/issues/119
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount: fix mnt_is_readonly() #ifdef

This issue affects util-linux portability to GNU/HURD

Reported-by: Pino Toscano (from Red Hat)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests: add sfdisk test

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: basic main() and friends

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk: move --list functionality to separated file

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk: improve --list output

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: implement --list

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: --list just one device

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: add --dump functionality

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: update usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk: refactor /proc/partitions usage

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: add --show-size

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: add comments, remove unnecessary function

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add fdisk_partition_is_bootable()

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: add --activate

Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk: cleanup comments and command_activate()

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: (dos) more carefully check for primary partitions

  * check if there is space for primary partitions, if no and extended
    exists then create logical partitions

  * create extended if @pa->type is extended partition

Signed-off-by: Karel Zak <kzak@redhat.com>