This change also removes a ghost prompt that was left in place when printing
help. When looking old commits the output fluke has been around at least
since util-linux v2.2.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Replacing long 'else' with 'continue' allows dropping one level of
indentation. Main aim is to improve code readability by reducing
complexity one needs to keep track while looking the code.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Pagers are not expected to have setuid or setgid bits, but assuming such
mistake has taken place try to avoid privilege escalation.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This change has three possitive effects: Avoid expansion code when it is
not needed. Stop wasting memory from stack for something rarely needed.
When command buffer is needed stop limiting it's size artificially.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
From man siglongjmp(3) 'longjmp() and siglongjmp() make programs hard to
understand and maintain. If possible, an alternative should be used.' That
manual page remark summarizes quite well why more(1) needs to move away from
jumping around.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
[kzak@redhat.com: - generate patch from Damien's v3
- make commands[] initialization more robust]
Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Introduce blkzone open, close and finish commands, issuing BLKOPENZONE,
BLKCLOSEZONE and BLKFINISHZONE ioctl commands to open, close or finish
a range of zones of a zoned block device.
Since these three commands are similar to the existing zone reset
command, the existing zone reset command implementation is changed into
the generic blkzone_action() internal handler function for processing
all zone actions.
The BLKOPENZONE, BLKCLOSEZONE and BLKFINISHZONE ioctl commands codes are
defined in linux/blkzoned.h starting with kernel version 5.5. To ensure
that the blkzone utility compiles even with older blkzoned.h kernel
header versions, these ioctl commands are internally defined if the
blkzoned.h header definition is not present. Execution of these commands
on kernels older than 5.5 will result in a -ENOTTY error (missing
ioctl).
Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Hans Holmberg <Hans.Holmberg@wdc.com>
Reviewed-by: Hans Holmberg <Hans.Holmberg@wdc.com>
* use fdisk --noauto-pt to avoid re-creation of the default architecture specific PT
* use more verbose "Created a new" messages in the output
Signed-off-by: Karel Zak <kzak@redhat.com>
The default partition table depends on system arch, for example on
Sparc it's SUN and on x86_64 it's MBR. This option forces fdisk to
keep the device empty and allow user to create non-default PT in more
elegant way.
Addresses: https://github.com/karelzak/util-linux/pull/994
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'eject-sparc' of https://github.com/mator/util-linux:
tests: fixes mount tests on SPARC
tests: fixes libmount/ on SPARC
tests: fixes eject/umount on SPARC
The zonefs filesystem was added to upstream linux kernel 5.6. This
patch add support for probing zonefs formatted zoned block devices so
that other file system formatting tool can detect its presence on a
device.
[kzak@redhat.com: - use standard integer types]
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch prevents to call the function strlen() with a NULL string
argument that leads to a segmentation fault.
Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
Since SPARC is using 'sun' partition table by default, make test not to
assume that disk has 'dos' partition table, so write 'dos' partition
table on disk, before proceeding any further.
Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
Autotoolz does not define HAVE_LCHOWN when the condition is false,
so it is appropriate to use #ifdef/#ifndef as everywhere else.
Signed-off-by: Karel Zak <kzak@redhat.com>
Just as with unshare and lsns this adds time namespace support to
nsenter.
In contrast to unshare nsenter does not have the options '--boottime'
and '--monotonic' as that offset can only be set as long as there have
no processes being started in the corresponding time namespace.
Signed-off-by: Adrian Reber <areber@redhat.com>
While working on getting time namespace support into 'nsenter' it was
not possible to use '-t' to enter a time namespace as '-t' is the short
option for '--target'. Fortunately '-T' is still available in 'nsenter'
and 'unshare' and therefore let's change 'unshare' to use the same flag
for the time namespace as 'nsenter'.
Signed-off-by: Adrian Reber <areber@redhat.com>