Let's consolidate the version printing code. It also seems better to
use exit() after --version, because it's handled in different way by
ASAN.
It's strange, but ASAN reports leaks after return in main(). Note that
we do not use free-before-exit.
Signed-off-by: Karel Zak <kzak@redhat.com>
This change fixes "warning: variable 'var' may be uninitialized when used
here [-Wconditional-uninitialized]" warnings reported in various files.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
It is not guaranteed that the returned string of readline() actually
contains as many bytes as buf can contain.
If bufsz is larger than the allocated memory by readline, an out of
boundary read occurs and leads to undefined behaviour. Most likely
that will be a crash.
This can be reproduced when readline-support is compiled in and when
you directly enter "quit" and "n" (to not write changes back to disk)
when sfdisk was called with any given device.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
In the disk summary it seems nice, but I'm not sure about lists (SIZE
columns). It seems more readable to keep the lists with one decimal
place only. New output:
# sfdisk --list /dev/sda
Old output:
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
New output:
Disk /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors
The rest is unchanged:
...
Device Start End Sectors Size Type
/dev/sda1 2048 411647 409600 200M EFI System
/dev/sda2 411648 821247 409600 200M Linux filesystem
/dev/sda3 821248 274087935 273266688 130.3G Linux filesystem
/dev/sda4 274087936 378945535 104857600 50G Linux filesystem
/dev/sda5 378945536 468862094 89916559 42.9G Linux filesystem
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1673452
Signed-off-by: Karel Zak <kzak@redhat.com>
* don't duplicate info on two places -- let's keep only small note
in mkswap(8) man page, suggest to read swapon(8) man page
* add info about kernel versions for XFS and Btrfs swapfiles support
* use subsection in the NOTES
Addresses: https://github.com/karelzak/util-linux/issues/633
Signed-off-by: Karel Zak <kzak@redhat.com>
* report failed partition type parsing
* make sure partition types code (from user reply) for MBR is hex
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
The man page warns against fallocate on some filesystems and recommends
dd(1) as the most portable solution. So, let's use dd(1) also in the
example used in the same man page.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1203378
Signed-off-by: Karel Zak <kzak@redhat.com>
The "grain" variable is used to calculate partitions alignment. The
default is 1MiB (or minimal I/O size). The libfdisk provides API to overwrite
this default, but this feature has been nowhere accessible for
end-user.
This patch support for "grain: <size>" in libfdisk scripts.
Addresses: https://github.com/karelzak/util-linux/issues/688
Signed-off-by: Karel Zak <kzak@redhat.com>
A developmental version of "groff" issued a warning, for example with
"test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z":
troff: <logger.1>:299: warning: can't find font 't'
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Command (m for help): d
No partition is defined yet!
Could not delete partition 93840461057817 <--- !
Don't print 'Could not delete..' if no partition is defined yet.
Addresses: https://github.com/karelzak/util-linux/issues/667
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - add note to the man page
- add '-' to the dialog query
- cleanup functions names and libfdisk.sym]
Signed-off-by: Karel Zak <kzak@redhat.com>
util-linux-2.32.1/disk-utils/mkfs.cramfs.c:362]: (style) Redundant condition: If 'EXPR >= 16777216', the comparison 'EXPR' is always true.
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Make sure partx exits with a non-0 return code when
it runs into either code-path where getting the partition
table failed (or wasn't even attempted because of previous
error condition).
Change was tested using:
touch /tmp/foobar
partx -s - /tmp/foobar
Previously that was only printing an error/warning message
and then exiting with 0, but after this change it exits
with 1.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Reported-by: Juan Céspedes <cespedes@debian.org>
Addresses: https://bugs.debian.org/898426
While looking earlier commit I noticed everything but formatting was removed
from a message in namei.c file. That inspired me to look if there are more
strings that does not need translation project attention. This change
removes at least some of them, if not all.
Reference: e19cc7b65b
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Use the correct macro (I, B) for the font change of one argument, not
those that are used for alternating two fonts, like "BR", "IR", "RB",
or "RI".
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
The header <ncursesw/ncurses.h> defines the get_wch(3) function only
when `NCURSES_WIDECHAR` is defined. This define is actually getting set
in the same header file, but only in case `_XOPEN_SOURCE` is defined and
has a value of 500 or higher. As we already have the precedence of
defining `_XOPEN_SOURCE` to a value of 600 in some other files, simply
define it to the minimum required value of 500 in "cfdisk.c". This
silences a warning for `get_wch` being unknown.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
* 'maybe-for-v2.32' of https://github.com/rudimeier/util-linux:
tests: use pgrep instead of ps --ppid ...
misc: fix typos using codespell
lsns: fix clang compiler warning
tests: add udevadm settle to sfdisk/resize
build-sys: disable bz2 tarball and fix some am warnings
This prevents a crash when running the command:
fsck -t AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA /dev/sda
Reported-by: Hornseth_Brenan@bah.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>