Commit Graph

51 Commits

Author SHA1 Message Date
Karel Zak aeba558136 readprofile: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:34:53 +02:00
Karel Zak 4f62b0b1dd readprofile: fix static analyzer warning [coverity scan]
Make sure we do not use step=0 and zero "fn_add - add0" as divisor.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-18 11:24:12 +01:00
Karel Zak 517debc389 readprofile: be more explicit with used types [cppcheck]
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-28 12:17:26 +02:00
Karel Zak 2c308875a7 misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Sami Kerola 4813a5210f various: fix 'uninitialized when used' warnings [clang]
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>
2019-02-18 13:19:24 +01:00
Sami Kerola cae9283ab1
readprofile: check input file is not empty [asan]
Addresses: https://github.com/karelzak/util-linux/issues/717
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-13 20:00:45 +00:00
Ruediger Meier f45f3ec34a misc: consolidate macro style USAGE_HELP_OPTIONS
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>
2017-06-29 16:54:33 +02:00
Ruediger Meier b1a294c448 misc: introduce print_usage_help_options()
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>
2017-06-27 12:26:19 +02:00
Ruediger Meier 86be6a32d3 misc: cosmetics, remove argument from usage(FILE*)
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>
2017-06-26 14:38:24 +02:00
Sami Kerola 8791804065 misc: do not use plain 0 as NULL [smatch scan]
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer

Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.

Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 12:58:49 +01:00
Karel Zak 677ec86cef Use --help suggestion on invalid option
The current default is to print all usage() output. This is overkill
in many case.

Addresses: https://github.com/karelzak/util-linux/issues/338
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 13:13:34 +01:00
Boris Egorov 01b63fcca2 readprofile: add scanf field width limits [cppcheck]
[sys-utils/readprofile.c:301]: (warning) scanf without field width limits can crash with huge input data.
[sys-utils/readprofile.c:322]: (warning) scanf without field width limits can crash with huge input data.
2016-01-19 12:59:12 +06:00
Boris Egorov e3ca1312a2 sys-utils/disk-utils/lib: fix printf format types [cppcheck]
Fix 'invalidPrintfArgType' cppcheck warnings

Signed-off-by: Boris Egorov <egorov@linux.com>
2015-06-25 12:08:45 +02:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Karel Zak 9b80bef687 readprofile: fix --reest (--reset) typo
Reported-by: Branislav Blaskovic <notifications@github.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-04 12:25:47 +01:00
Benno Schulenberg b50945d4ac textual: spell and encode the name of Arkadiusz Miśkiewicz correctly
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:02 +01:00
Karel Zak 8f3b568cd7 fdisk: fix compiler warning [-Wpointer-arith] and floating point exception
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 15:10:26 +02:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Karel Zak cda9acbe35 readprifile: remove unnecessary optstring array
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-14 13:28:50 +01:00
Sami Kerola a3f0ea51e4 readprofile: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-02 18:41:56 +01:00
Sami Kerola c416814a6b readprofile: use libc error printing facilities
This commit also changes all exit values to be symbolic.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-02 18:41:56 +01:00
Sami Kerola 443f731303 readprofile: add long options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-02 18:41:56 +01:00
Petr Uzel 960cf5737e misc: use %m in format string instead of %s and strerror(errno)
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-09-27 15:46:07 +02:00
Karel Zak 33d18dc435 readprofile: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01 13:07:32 +02:00
Po-Yu Chuang 236faa7eaf readprofile: don't stop parsing at __init_end
Some architectures like ARM place __init_end before .text section.
If any function in .init section is hit while profiling, readprofile
stops at __init_end.  That means if we enable profiling at boot time,
the profiler probably hits init functions and readprofile does not
work well unless we reset profiling buffer with -r option.

Signed-off-by: Po-Yu Chuang <ratbert@faraday-tech.com>
2011-04-12 12:10:54 +02:00
Davidlohr Bueso 2ab428f6a8 sys-utils: make use xalloc wrappers
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-01 16:43:23 +01:00
Pedro Ribeiro 39a5a2314b readprofile: several strings without gettext calls
Signed-off-by: Pedro Ribeiro <p.m42.ribeiro@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-10-03 09:27:33 +02:00
Matthias Koenig 5a3009cad6 readprofile: fix on ppc64
Fix inconsistency between kernel profiling and readprofile.
The range of kernel profiling is between _stext and _etext,
and readprofile tries to extract profiling for all the symbols in
/boot/System.map-2.6.16.11-7-ppc64 from /proc/profile, but there
are more symbols in /boot/System.map-2.6.16.11-7-ppc64 than those
between _stext and _etext.

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-24 14:28:40 +02:00
Mike Frysinger db94975b59 also search for __stext in readprofile
Some architectures have a single underscore prefix in their ABI, so there will
be no "_stext" symbol, just "__stext".

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2007-07-10 14:12:44 +02:00
Karel Zak baf39af15b Imported from util-linux-2.13-pre2 tarball. 2006-12-07 00:26:58 +01:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak b22550fa15 Imported from util-linux-2.12k tarball. 2006-12-07 00:26:26 +01:00
Karel Zak d162fcb550 Imported from util-linux-2.12j tarball. 2006-12-07 00:26:24 +01:00
Karel Zak c129767e06 Imported from util-linux-2.12b tarball. 2006-12-07 00:26:16 +01:00
Karel Zak d03dd60840 Imported from util-linux-2.12a tarball. 2006-12-07 00:26:14 +01:00
Karel Zak df1dddf9ff Imported from util-linux-2.12 tarball. 2006-12-07 00:26:12 +01:00
Karel Zak f0c8eda12c Imported from util-linux-2.11u tarball. 2006-12-07 00:26:00 +01:00
Karel Zak 1d4ad1decc Imported from util-linux-2.11q tarball. 2006-12-07 00:25:54 +01:00
Karel Zak ffc4374869 Imported from util-linux-2.11o tarball. 2006-12-07 00:25:53 +01:00
Karel Zak 612721dba8 Imported from util-linux-2.11n tarball. 2006-12-07 00:25:52 +01:00
Karel Zak e8f2641919 Imported from util-linux-2.11m tarball. 2006-12-07 00:25:49 +01:00
Karel Zak 364cda4857 Imported from util-linux-2.11f tarball. 2006-12-07 00:25:48 +01:00
Karel Zak c07ebfa1e0 Imported from util-linux-2.11b tarball. 2006-12-07 00:25:46 +01:00
Karel Zak 66ee8158b6 Imported from util-linux-2.10s tarball. 2006-12-07 00:25:44 +01:00
Karel Zak 22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +01:00
Karel Zak eb63b9b8f4 Imported from util-linux-2.10f tarball. 2006-12-07 00:25:41 +01:00
Karel Zak 7eda085c41 Imported from util-linux-2.9v tarball. 2006-12-07 00:25:39 +01:00
Karel Zak 2b6fc908bc Imported from util-linux-2.8 tarball. 2006-12-07 00:25:35 +01:00
Karel Zak fd6b7a7ffc Imported from util-linux-2.7.1 tarball. 2006-12-07 00:25:34 +01:00