Use plain int instead of type defining it to a boolean, and use numbers to
signify true or false as we do everywhere else in this source tree. And in
hwclock-cmos.c file booleans weren't even needed, to the related code is
removed.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Bug fixed:
---
678: fdisk: ASK: asking for number ['Partition number', <1,4>, default=1, range: 1-4]
678: fdisk: ASK: asking for user replay [interactive]
Partition number (1-4, default 1): 12345
678: fdisk: ASK: user's reply: >>>12345<<<
Value out of range.
678: fdisk: ASK: asking for user replay [interactive]
Partition number (1-4, default 1): 1
678: fdisk: ASK: user's reply: >>>12345<<<
Value out of range.
678: fdisk: ASK: asking for user replay [interactive]
Partition number (1-4, default 1):
678: fdisk: ASK: user's reply: >>>22345<<<
Value out of range.
---
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Update debug messages for a combined --systz and --hctosys in
the set_system_clock function.
New debug messages:
hwclock --test -D --systz --localtime
Calling settimeofday(NULL, 240) to warp System time.
Test mode: clock was not changed
hwclock --test -D --systz --utc
Calling settimeofday(NULL, 0) to lock the warp function.
Calling settimeofday(NULL, 240) to set the kernel timezone.
Test mode: clock was not changed
hwclock --test -D --hctosys --utc
Calling settimeofday(1502239269.733639, 240)
Test mode: clock was not changed
hwclock --test -D --hctosys --localtime
Calling settimeofday(NULL, 240) to set persistent_clock_is_local.
Calling settimeofday(1502253708.200200, 240)
Test mode: clock was not changed
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Remove set_system_clock_timezone() because the previous patch
moved its functionality into set_system_clock().
Signed-off-by: J William Piggott <elseifthen@gmx.com>
The set_system_clock_timezone() function is nearly identical to
set_system_clock(). Three additional statements are required
to include systz in hctosys.
This patch is intentionally incomplete to make reviewing the
actual required changes easier. Other patches in this set will:
* remove set_system_clock_timezone()
* fix messages and debugging
* fix comments
* and finally refactor set_system_clock()
Signed-off-by: J William Piggott <elseifthen@gmx.com>
The high-level readline API is crazy to use with signals. Fortunately
the library provides low-level rl_callback_* API. In this case we can
use poll() to wait for input and control all signals, etc.
This patch also a little changes fdisk behavior on CTRL+C and CTRL+D.
The signals does not kill fdisk, but forces fdisk to return to the
main menu, if already in the main menu then exit. If the disk layout
has been modified than ask "Do you really want to exit...".
Signed-off-by: Karel Zak <kzak@redhat.com>
make function wrapping rl_fgets() and fputs()&fgets() to remove
code duplication in get_user_reply().
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Fixes one leak and one unchecked allocation error.
[kzak@redhat.com: - don't call fdisk_ask_menu_get_result()
after failed fdisk_do_ask()]
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's provide API for applications that don't want to use the default
1MiB grain. The new function allow to use "as minimal as possible" if
grain is set by fdisk_save_user_grain() to 512.
If the phy sector size (or minimal I/O size) is greater than specified
grain size than smallest possible setting is used.
Signed-off-by: Karel Zak <kzak@redhat.com>
If partition does not require alignment, then don't call LBA align
function and don't use size-=1 (fdisk_align_lba_in_range() returns
unmodified size and we call size=-1 more than once for the same size).
Signed-off-by: Karel Zak <kzak@redhat.com>
Earlier the command exit too early if one of the arguments failed. After
this change all arguments are examined, and command return value will have
information what happen during processing.
Based on patch from Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
The MBR partition pseudo-UUID is generated from table ID and partition
partno. The final UUID size limit is 37 bytes. The table ID has to be
restricted to keep compiler happy (for MBR the table ID is 8 bytes
as string).
Signed-off-by: Karel Zak <kzak@redhat.com>
The getrandom() does not have to return all requested bytes (missing
entropy or when interrupted by signal). The current implementation in
util-linux stupidly asks for all random data again, rather than only
for missing bytes.
The current code also does not care if we repeat our requests for
ever; that's bad.
This patch uses the same way as we already use for reading from
/dev/urandom. It means:
* repeat getrandom() for only missing bytes
* limit number of unsuccessful request (16 times)
* fallback to /dev/urandom on ENOSYS (old kernel or so...)
Addresses: https://github.com/karelzak/util-linux/issues/496
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'master' of https://github.com/RAOF/util-linux:
lib/randutils.c: More paranoia in getrandom() call.
lib/randutils.c: Fall back gracefully when kernel doesn't support getrandom(2).
If getrandom() is called with nbytes ≥ 256 then it can return with less than the requested
bytes filled.
In this case we *could* adjust the buffer by the number of bytes actually read, but it's
simpler to just redo the call.
The 3.16 kernel is supported until 2020, and various distros have kernels of the same
vintage. It's entirely possible for code built against newer headers to be run against
these kernels, so fall-back to the old “read /dev/{u,}random” method if the kernel doesn'
support getrandom()
This command has a lot of compile time #ifdef code. It is time to add
feature listing to --version output so understanding command behavior is
easier.
Proposed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
There is no ./configure option to enable this, and it is unlikely any
distribution hot patching to enable fiddling when building package.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>