summaryrefslogtreecommitdiffstats
path: root/misc-utils
Commit message (Collapse)AuthorAgeFilesLines
* lsblk: fix -E segfaultKarel Zak2019-07-151-0/+2
| | | | | | | | We need to check if referenced wholedisk defines the de-duplication key... Addresses: https://github.com/karelzak/util-linux/issues/819 Signed-off-by: Karel Zak <kzak@redhat.com>
* include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attributeSami Kerola2019-07-141-1/+7
| | | | | | | Turned out lsblk is passing null as argument to xstrdup(), so fix that and add assert() to make sure promise of not returning null is kept in future. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsblk: force to print PKNAME for partitionKarel Zak2019-06-271-0/+3
| | | | | | | | | | PKNAME (parent kernel device name) is based on printed tree according to parent -> child relationship. The tree is optional and not printed if partition specified (.e.g "lsblk -o+PKNAME /dev/sda1"), but old versions print the PKNAME also in this case. Addresses: https://github.com/karelzak/util-linux/issues/813 Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: (verify) ignore passno for XFSKarel Zak2019-06-121-3/+9
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1719069 Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: fix bad formatting in hardlink.1Karel Zak2019-05-311-10/+10
| | | | | | | | * fix regex\f to regex\fR (issue #805) * replace \fP with \fR to be consistent with our another man pages Addresses: https://github.com/karelzak/util-linux/issues/805 Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: fix filters use on --listKarel Zak2019-05-291-1/+1
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1714826 Signed-off-by: Karel Zak <kzak@redhat.com>
* whereis: make subdirs scan more robustKarel Zak2019-05-231-10/+27
| | | | | | | | | * call strchr() only once * avoid things like strcat(buf, strchr(dir, '*') + 1) * make it more readable * improve debug messages Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: make sure __process_one_device() has proper arguments [coverity scan]Karel Zak2019-05-231-2/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: check ul_path_scanf() return value [coverity scan]Karel Zak2019-05-231-4/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: check stat() return code [coverity scan]Karel Zak2019-05-231-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: make code more robust for static analyzer [clang scan]Karel Zak2019-05-231-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: avoid uninitialized variables [clang scan]Karel Zak2019-05-231-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* whereis: use xstrncpy()Karel Zak2019-05-201-4/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2019wk19' of https://github.com/kerolasa/util-linuxKarel Zak2019-05-201-4/+4
|\ | | | | | | | | | | | | | | | | | | | | * '2019wk19' of https://github.com/kerolasa/util-linux: lib/colors: remove redundant if statement wipefs: fix variable / function shadowing [cppcheck] sulogin: fix variable / function shadowing [cppcheck] lscpu: remove redundant condition check [cppcheck] libmount: avoid possible null pointer dereference [cppcheck] lib/mangle: fix possible null pointer dereference [cppcheck] sfdisk: remove unnecessary size check [cppcheck]
| * wipefs: fix variable / function shadowing [cppcheck]Sami Kerola2019-05-181-4/+4
| | | | | | | | | | | | | | [misc-utils/wipefs.c:636] -> [misc-utils/wipefs.c:310]: (style) Local variable usage shadows outer function Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | findmnt: keep it easy for static analyzersKarel Zak2019-05-161-1/+2
| |
* | findmnt: (verify) check mnt_table_next_fs() return code [coverity scan]Karel Zak2019-05-161-1/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | fincore: remove unused variable [clang scan]Karel Zak2019-05-161-6/+2Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | cal: make sure months_in_row makes sense [coverity scan]Karel Zak2019-05-161-5/+11
| | | | | | | | | | | | | | * avoid divide by zero in mountly() dues to wrong months_in_row * make sure months_in_row is at least 1 Signed-off-by: Karel Zak <kzak@redhat.com>
* | blkid: improve strcpy() usage [coverity scan]Karel Zak2019-05-161-3/+8
|/ | | | | | | The old deprecated list output format ("-o list") copies gettex string into fixed buffer, that's really bad idea. Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: fix "maybe be" duplicationAustin English2019-05-151-3/+3
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* lsblk: fix heap-use-after-freeKarel Zak2019-05-061-0/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/787 Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: add more debug messagesKarel Zak2019-05-021-5/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: fix compiler warnings [-Wsign-compare -Wmaybe-uninitialized]]Karel Zak2019-05-021-3/+3
| | | | | | | | | | misc-utils/hardlink.c: In function ‘process_path’: misc-utils/hardlink.c:287:30: warning: operand of ?: changes signedness from ‘off_t’ {aka ‘long int’} to ‘long unsigned int’ due to unsignedness of other operand [-Wsign-compare] misc-utils/hardlink.c: In function ‘main’: misc-utils/hardlink.c:455:5: warning: ‘exclude_pattern’ may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: retire NIOBUF in favour of more common BUFSIZSami Kerola2019-05-011-5/+5
| | | | | | | | | | Reason to retire NIOBUF is that it is obscure local definition, while BUFSIZ is well understood and commonly used constant. Besized sizes of these are not far off, the NIOBUF was 4096 bytes and BUFSIZ tends to be 8192 bytes. Proposed-by: Karel Zak <kzak@redhat.com> Reference: https://github.com/karelzak/util-linux/pull/783 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hardlink: move global variables to a control structureSami Kerola2019-05-011-68/+78
| | | | | | | | | | Well, sort of. Due to use of ctl values in atexit() print_summary() there is need for global control structure. Secondly couple variables can be moved to more restricted scope, namely the PCRE variables are now in main(). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hardlink: use flexible array member rather than zero-size arraySami Kerola2019-05-011-2/+2
| | | | | | | | | This fixes two standards compliancy warnings. hardlink.c:65:7: warning: ISO C forbids zero-size array ‘name’ [-Wpedantic] Reference: https://en.wikipedia.org/wiki/Flexible_array_member Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hardlink: remove \r from outputKarel Zak2019-04-241-13/+3Star
| | | | | | | | | | | * remove \r from internationalized messages * remove \r from all output to make it easy to use (see for example output file from "hardlink -vv --dry-run . &> log") * remove unnecessary formatting stuff from output, just keep is simple and stupid... Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-1620-89/+77Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/c: add print_version() macroKarel Zak2019-04-161-8/+3Star
| | | | | | | | | | | 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>
* lib/fileutils: add xreaddir()Karel Zak2019-04-111-18/+1Star
| | | | | | | Remove duplicate code and keep only one implementation in include/fileutils.h. Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: fix excl[] array orderKarel Zak2019-03-191-0/+1
| | | | | | It (rows and columns) must be in ASCII order. Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: force tree on --json --tree independently on used columnsKarel Zak2019-03-182-2/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: (man) cleanup return code sectionKarel Zak2019-03-111-1/+2
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/764 Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: allow to specify tree columnKarel Zak2019-02-203-10/+26
| | | | | | | | | | | | | | | * document --tree (was missing in the man page) * add optional argument to --tree to specify tree For example: $ lsblk -o KNAME,SIZE,MOUNTPOINT --tree=KNAME /dev/dm-0 KNAME SIZE MOUNTPOINT dm-0 232.9G └─dm-1 232.9G └─dm-2 232.9G Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: fix typos [codespell]Sami Kerola2019-02-183-3/+3
| | | | | Reference: https://github.com/codespell-project/codespell Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hardlink, wall: fix variable shadowingSami Kerola2019-02-181-2/+2
| | | | | | | | | | | | | misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow] misc-utils/hardlink.c:73:5: note: previous declaration is here int content_only = 0; term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow] term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow] /usr/include/bits/getopt_core.h:36:14: note: previous declaration is here extern char *optarg; Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* various: fix 'uninitialized when used' warnings [clang]Sami Kerola2019-02-183-3/+4
| | | | | | | 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>
* cal: fix Sexit and SenterKarel Zak2019-02-181-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: add long optionsKarel Zak2019-02-112-23/+37
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: rename functionKarel Zak2019-02-111-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: make code more readableKarel Zak2019-02-111-9/+31
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: cleanup global variablesKarel Zak2019-02-111-20/+23
| | | | | | | | * remove NAMELEN, use PATH_MAX * mark global variables as static * move all global variables to the begin of the code Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: remove typedefsKarel Zak2019-02-111-32/+33
| | | | | | | - remove typedefs - use long names for structs Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: use ID_SCSI_SERIAL when availableSven Wiltink2019-02-111-1/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: cleanup error messages, use xalloc.hKarel Zak2019-02-061-48/+30Star
| | | | | | | - do not use magical doexit(), just use err() - print summary on exit Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: cleanup verbose and warning messagesKarel Zak2019-02-061-61/+43Star
| | | | | | | - use warn() - use stdout rather than stderr Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink: (man) add AVAILABILITYKarel Zak2019-02-061-3/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'hardlink' of https://github.com/rudimeier/util-linux into hardlinkKarel Zak2019-02-063-0/+608
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'hardlink' of https://github.com/rudimeier/util-linux: (25 commits) hardlink: add first simple tests hardlink: util-linux usage hardlink: fix compiler warnings hardlink: style indentations and license header hardlink: enable build with and without pcre2 fixes for the fixes temporal fix before re-patch (updates from Fedora repo) Update hardlink.1 Fixed version number, added changelog about Todd Lewis' patch exclude files via pcre Fixed 32 bit build with gcc7 (RH Bugzilla ID 1422989) spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); update FSF address at .c source file Revert "spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file" spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file Mention -f option in the man page do not allow to hardlink files across filesystems by default (#786719) (use -f option to override) fix possible buffer overflows, integer overflows, update man page fix URL and remove mmap() (#676962, #672917) - update docs to describe highest verbosity -vv option (#210816) - use dist Resolves: 210816 mostly spec cleanup ...
| * hardlink: util-linux usageRuediger Meier2018-11-141-20/+51
| | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>