Sorry detail-oriented people tend to wipe these out if they notice them.
Add in automated tools and lots of excess end-of-line spaces get wiped
out.
Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
If util-linux is installed on a system without large file support,
an out of memory issue can occur while processing a file which is
2 GB in size:
$ ./configure --disable-largefile && make
$ dd if=/dev/zero of=2gb-file seek=2147483646 count=1 bs=1
$ fincore 2gb-file
(endless loop)
fincore: failed to do mmap: 2gb-file: Cannot allocate memory
Even though iterating with "len" seems counter-intuitive, it fixes
this issue. The variable len is only in the last iteration not a
multiplication of pagesize -- which is the requirement for mmap.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
If a file is larger than 4 GB on a 32 bit system with large file
support (default), it can happen that not all pages are properly
processed. This happens due to an int truncation (off_t vs size_t).
You can reproduce this on 32 bit with these commands:
$ dd if=/dev/zero of=4gb-file seek=4294967295 count=1 bs=1
$ fincore 4gb-file
fincore: failed to do mmap: 4gb-file: Invalid argument
If a file is larger than 4 GB, the first few pages of a file won't
be properly processed. "len" will be smaller than window_size,
but the for-loop iterates "window_size" bytes, skipping some pages.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
changed in include/c.h and applied via sed:
sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Consolidate --help and --version descriptions. We are
now able to align them to the other options.
We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This patch is trivial and changes nothing, because
we were always using usage(stdout)
Now all our usage() functions look very similar. If wanted we
could auto-generate another big cosmetical patch to remove all
the useless "FILE *out" constants and use printf and puts
rather than their f* friends. Such patch could be automatically
synchronized with the translation project (newlines!) to not
make the translators sick.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
It seems better to avoid "int" at all from sizes calculations to make
the code more robust for future changes.
Signed-off-by: Karel Zak <kzak@redhat.com>