thirdparty/util-linux.git
13 hours agoMerge branch 'topic/wdctl' master
Karel Zak [Mon, 17 Jun 2019 13:48:28 +0000 (15:48 +0200)]
Merge branch 'topic/wdctl'

13 hours agowdctl; read from /sys if necessary
Karel Zak [Thu, 6 Jun 2019 09:17:13 +0000 (11:17 +0200)]
wdctl; read from /sys if necessary

The device can be inaccessible for non-root user or busy (already used
by another process). In this case it seems better to read information
from /sys.

Note that /sys does not provide struct watchdog_info.options, so we
cannot print list of supported watchdog features.

Addresses: https://github.com/karelzak/util-linux/issues/804
Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agolib/path: make sure ul_path_read_buffer() derminate result
Karel Zak [Thu, 6 Jun 2019 09:09:17 +0000 (11:09 +0200)]
lib/path: make sure ul_path_read_buffer() derminate result

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agowdctl: default to /dev/watchdog0
Karel Zak [Fri, 31 May 2019 12:49:23 +0000 (14:49 +0200)]
wdctl: default to /dev/watchdog0

Let's use miscdev /dev/watchdog as fallback only. We need (if possible)
cdev /dev/watchdog0 as this device has entry in /sys/class/watchdog.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agowdctl: remove printing from main()
Karel Zak [Fri, 31 May 2019 12:25:41 +0000 (14:25 +0200)]
wdctl: remove printing from main()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agowdctl: add control struct
Karel Zak [Fri, 31 May 2019 12:18:19 +0000 (14:18 +0200)]
wdctl: add control struct

* remove global variables
* keep all together

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agowdctl: rename watch dog info struct
Karel Zak [Fri, 31 May 2019 12:06:04 +0000 (14:06 +0200)]
wdctl: rename watch dog info struct

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agoinclude/closestream: avoid close more than once
Karel Zak [Thu, 13 Jun 2019 11:25:44 +0000 (13:25 +0200)]
include/closestream: avoid close more than once

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agomisc: replaces atexit(close_stdout) with new close_stdout_atexit()
Karel Zak [Thu, 13 Jun 2019 11:22:32 +0000 (13:22 +0200)]
misc: replaces atexit(close_stdout) with new close_stdout_atexit()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agolibfdisk: fix fdisk_script_get_table()
Karel Zak [Mon, 10 Jun 2019 09:43:56 +0000 (11:43 +0200)]
libfdisk: fix fdisk_script_get_table()

Make sure we never return NULL and we reuse the table in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agolibfdisk: (docs) add notes about fdisk_enable_wipe()
Karel Zak [Fri, 7 Jun 2019 11:21:23 +0000 (13:21 +0200)]
libfdisk: (docs) add notes about fdisk_enable_wipe()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agolibfdisk: add fdisk_script_set_table()
Karel Zak [Fri, 7 Jun 2019 10:20:53 +0000 (12:20 +0200)]
libfdisk: add fdisk_script_set_table()

This small change improves possibility to modify by script described
PT and use script API in another tools as primary way to create
partitions.

All you need is to compose script by fdisk_script_set_header() and
fdisk_script_set_table() and than apply by fdisk_apply_script().

Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 hours agolscpu: add a new columns to --cache
Karel Zak [Thu, 6 Jun 2019 12:05:26 +0000 (14:05 +0200)]
lscpu: add a new columns to --cache

References: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu
Signed-off-by: Karel Zak <kzak@redhat.com>
16 hours agodocs: we have 2019 already
Karel Zak [Mon, 17 Jun 2019 10:55:25 +0000 (12:55 +0200)]
docs: we have 2019 already

Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agobuild-sys: release++ (v2.34) v2.34
Karel Zak [Fri, 14 Jun 2019 10:34:10 +0000 (12:34 +0200)]
build-sys: release++ (v2.34)

Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agodocs: update v2.34-ReleaseNotes
Karel Zak [Fri, 14 Jun 2019 10:32:22 +0000 (12:32 +0200)]
docs: update v2.34-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agodocs: update AUTHORS file
Karel Zak [Fri, 14 Jun 2019 10:30:20 +0000 (12:30 +0200)]
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agopo: merge changes
Karel Zak [Fri, 14 Jun 2019 10:18:19 +0000 (12:18 +0200)]
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agopo: update zh_CN.po (from translationproject.org)
Boyuan Yang [Fri, 14 Jun 2019 10:13:54 +0000 (12:13 +0200)]
po: update zh_CN.po (from translationproject.org)

3 days agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Fri, 14 Jun 2019 10:13:54 +0000 (12:13 +0200)]
po: update uk.po (from translationproject.org)

3 days agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update sv.po (from translationproject.org)

3 days agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update pt_BR.po (from translationproject.org)

3 days agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update pl.po (from translationproject.org)

3 days agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update ja.po (from translationproject.org)

3 days agopo: update hr.po (from translationproject.org)
Božidar Putanec [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update hr.po (from translationproject.org)

3 days agopo: update fr.po (from translationproject.org)
Frédéric Marchal [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update fr.po (from translationproject.org)

3 days agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update es.po (from translationproject.org)

3 days agopo: update de.po (from translationproject.org)
Mario Blättermann [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update de.po (from translationproject.org)

3 days agopo: update da.po (from translationproject.org)
Joe Hansen [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update da.po (from translationproject.org)

3 days agopo: update cs.po (from translationproject.org)
Petr Písař [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)]
po: update cs.po (from translationproject.org)

3 days agotests: update build-sys output
Karel Zak [Fri, 14 Jun 2019 10:06:58 +0000 (12:06 +0200)]
tests: update build-sys output

It seems, no more libgcc_s...

Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agolibsmartcols: fix docs
Karel Zak [Thu, 13 Jun 2019 11:45:46 +0000 (13:45 +0200)]
libsmartcols: fix docs

Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agolibmount: fix docs typo
Karel Zak [Thu, 13 Jun 2019 11:45:39 +0000 (13:45 +0200)]
libmount: fix docs typo

Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agorev: be careful with close()
Karel Zak [Thu, 13 Jun 2019 10:59:39 +0000 (12:59 +0200)]
rev: be careful with close()

Addresses: https://github.com/karelzak/util-linux/issues/807
Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agofindmnt: (verify) ignore passno for XFS
Karel Zak [Wed, 12 Jun 2019 09:02:51 +0000 (11:02 +0200)]
findmnt: (verify) ignore passno for XFS

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1719069
Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agolib/sysfs: fix reference counting for parent
Karel Zak [Tue, 11 Jun 2019 10:11:32 +0000 (12:11 +0200)]
lib/sysfs: fix reference counting for parent

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agocfdisk: free libfdisk items
Karel Zak [Tue, 11 Jun 2019 09:22:22 +0000 (11:22 +0200)]
cfdisk: free libfdisk items

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agofstrim: update man page, reuse libmnt_iter
Karel Zak [Tue, 11 Jun 2019 09:05:12 +0000 (11:05 +0200)]
fstrim: update man page, reuse libmnt_iter

* add info about read-only to the man page
* don't be systemd specific, people aso use crond
* reuse libmnt_iter

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agocfdisk: simplify code
Karel Zak [Tue, 11 Jun 2019 08:54:22 +0000 (10:54 +0200)]
cfdisk: simplify code

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agofstrim: properly de-duplicate fstrim -A
Stanislav Brabec [Mon, 10 Jun 2019 19:59:17 +0000 (21:59 +0200)]
fstrim: properly de-duplicate fstrim -A

fstab can contain tag based mounts. De-duplication by source has to be
done after resolving the full source path.

Perform the table iteration twice. First time, prepare for
de-duplication, second time perform the TRIM itself.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
6 days agofstrim -a/-A: Skip read-only volumes
Stanislav Brabec [Mon, 10 Jun 2019 19:59:45 +0000 (21:59 +0200)]
fstrim -a/-A: Skip read-only volumes

Calling TRIM on some read-only volumes can fail with:
fstrim: /win: FITRIM ioctl failed: Bad file descriptor

Skipping all read-only mounts seems to be safe and logical strategy.

Fixes opensuse#1106214.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
6 days agofstrim: Fix fstrim_all() comment
Stanislav Brabec [Mon, 10 Jun 2019 19:59:21 +0000 (21:59 +0200)]
fstrim: Fix fstrim_all() comment

"convert LABEL=" does not happens in mnt_fs_get_source(), but later in
mnt_resolve_spec(). To make this more clean, move the comment before this
chunk of code.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
7 days agolib/canonicalize: fix compiler warning [-Wsign-compare]
Karel Zak [Mon, 10 Jun 2019 09:00:38 +0000 (11:00 +0200)]
lib/canonicalize: fix compiler warning [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolibmount: (docs) add reference to v2.33 and v2.34
Karel Zak [Fri, 7 Jun 2019 10:37:28 +0000 (12:37 +0200)]
libmount: (docs) add reference to v2.33 and v2.34

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolibsmartcols: (docs) add reference to v2.33 and v2.34
Karel Zak [Fri, 7 Jun 2019 10:32:45 +0000 (12:32 +0200)]
libsmartcols: (docs) add reference to v2.33 and v2.34

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolibfdisk: (docs) add reference to v2.33
Karel Zak [Fri, 7 Jun 2019 10:30:13 +0000 (12:30 +0200)]
libfdisk: (docs) add reference to v2.33

Signed-off-by: Karel Zak <kzak@redhat.com>
11 days agoumount: be more strict about --all
Karel Zak [Thu, 6 Jun 2019 12:52:40 +0000 (14:52 +0200)]
umount: be more strict about --all

If you by accident execute

umount ls -al /mnt/

then umount --all is executed and another arguments silently ignored.
It seems better to be more strict in this case.

Reported-by: Harald Dunkel <harald.dunkel@aixigo.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 days agowall: make sure ut_line is not empty
Karel Zak [Thu, 6 Jun 2019 10:33:03 +0000 (12:33 +0200)]
wall: make sure ut_line is not empty

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1711574
Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agolibblkid: fix detection of dm-integrity superblock version
Milan Broz [Tue, 4 Jun 2019 10:16:57 +0000 (12:16 +0200)]
libblkid: fix detection of dm-integrity superblock version

Kernel 5.2 can use superblock version 3 for dm-integrity.
Let's remove the explicit version check to be compatible
with future extensions.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2 weeks agohardlink: fix bad formatting in hardlink.1
Karel Zak [Fri, 31 May 2019 09:50:40 +0000 (11:50 +0200)]
hardlink: fix bad formatting in hardlink.1

* 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>
2 weeks agodocs: add lscpu --caches to ReleaseNotes
Karel Zak [Fri, 31 May 2019 09:48:10 +0000 (11:48 +0200)]
docs: add lscpu --caches to ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agobuild-sys: release++ (v2.34-rc2) v2.34-rc2
Karel Zak [Thu, 30 May 2019 10:06:50 +0000 (12:06 +0200)]
build-sys: release++ (v2.34-rc2)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agodocs: update v2.34-ReleaseNotes
Karel Zak [Thu, 30 May 2019 10:01:36 +0000 (12:01 +0200)]
docs: update v2.34-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agodocs: update AUTHORS file
Karel Zak [Thu, 30 May 2019 09:58:26 +0000 (11:58 +0200)]
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agopo: merge changes
Karel Zak [Thu, 30 May 2019 09:54:20 +0000 (11:54 +0200)]
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agopo: update hr.po (from translationproject.org)
Božidar Putanec [Thu, 30 May 2019 09:49:43 +0000 (11:49 +0200)]
po: update hr.po (from translationproject.org)

2 weeks agolibmount: add selinuxfs between pseudo filesystems
Karel Zak [Wed, 29 May 2019 16:01:04 +0000 (18:01 +0200)]
libmount: add selinuxfs between pseudo filesystems

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1714826
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: add bpf between pseudo filesystems
Karel Zak [Wed, 29 May 2019 16:01:04 +0000 (18:01 +0200)]
libmount: add bpf between pseudo filesystems

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1714826
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agofindmnt: fix filters use on --list
Karel Zak [Wed, 29 May 2019 15:59:33 +0000 (17:59 +0200)]
findmnt: fix filters use on --list

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1714826
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agotests: add asan build-sys test
Karel Zak [Wed, 29 May 2019 11:22:01 +0000 (13:22 +0200)]
tests: add asan build-sys test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agofdisk: add note about -S and -H
Karel Zak [Tue, 28 May 2019 13:12:31 +0000 (15:12 +0200)]
fdisk: add note about -S and -H

It's seems people still follow old advices for SSD/4K devices. Let's
make CHS deprecation more visible at the begin of the man page...

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoul: make sure buffers are zeroized [coverity scan]
Karel Zak [Tue, 28 May 2019 11:33:03 +0000 (13:33 +0200)]
ul: make sure buffers are zeroized [coverity scan]

2 weeks agocolumn: make code more robust [coverity scan]
Karel Zak [Tue, 28 May 2019 11:25:15 +0000 (13:25 +0200)]
column: make code more robust [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agosetpriv: fix memory leak in local scope [coverity scan]
Karel Zak [Tue, 28 May 2019 11:11:14 +0000 (13:11 +0200)]
setpriv: fix memory leak in local scope [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agosetarch: avoid NULL dereference [coverity check]
Karel Zak [Tue, 28 May 2019 11:08:21 +0000 (13:08 +0200)]
setarch: avoid NULL dereference [coverity check]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agortcwake: terminate mode and excl[]
Karel Zak [Tue, 28 May 2019 10:53:58 +0000 (12:53 +0200)]
rtcwake: terminate mode and excl[]

* terminate string read from /proc
* terminate array for exclusive options

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agobuild-sys: add info about ASAN
Karel Zak [Tue, 28 May 2019 10:37:14 +0000 (12:37 +0200)]
build-sys: add info about ASAN

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agorenice: make code more readable for static analyzer [coverity scan]
Karel Zak [Tue, 28 May 2019 10:19:23 +0000 (12:19 +0200)]
renice: make code more readable for static analyzer [coverity scan]

It seems coverity and clag have no clue about relation between argv[]
and argc. Let's make code more readable for them...

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoreadprofile: be more explicit with used types [cppcheck]
Karel Zak [Tue, 28 May 2019 10:17:26 +0000 (12:17 +0200)]
readprofile: be more explicit with used types [cppcheck]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolscpu: check scols_line_set_data() return value [coverity scan]
Karel Zak [Tue, 28 May 2019 10:05:03 +0000 (12:05 +0200)]
lscpu: check scols_line_set_data() return value [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolscpu: make lookup() use more consistent [coverity scan]
Karel Zak [Tue, 28 May 2019 09:58:51 +0000 (11:58 +0200)]
lscpu: make lookup() use more consistent [coverity scan]

We usually check lookup() return value. Let's do it in this case too.
It seems static analyzers will be happy with consistent code.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agomesg: avoid 'ttyname failed: Success' message
Karel Zak [Mon, 27 May 2019 11:07:12 +0000 (13:07 +0200)]
mesg: avoid 'ttyname failed: Success' message

The ttyname(3) can fail to access /dev/ path, and that will cause function
to fail without setting errno value with result of rather confusing error
message.  Lets start setting stdin permission via /proc when this happens as
a go-around, with hope kernel following symlink does not fail.  Ok, noted,
that hopes of symlink follow working are pretty slim.

Based on patch from Sami Kerola <kerolasa@iki.fi>.

Reference: https://github.com/lxc/lxd/issues/1724
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/ttyutils: introduce get_terminal_stdfd()
Karel Zak [Mon, 27 May 2019 10:49:12 +0000 (12:49 +0200)]
lib/ttyutils: introduce get_terminal_stdfd()

Let's use separate function to detect what is the current terminal.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibblkid: remove unneeded fields from struct bcache_super_block
Sami Kerola [Thu, 23 May 2019 20:06:23 +0000 (21:06 +0100)]
libblkid: remove unneeded fields from struct bcache_super_block

This started as fix to following warning.

    libblkid/src/superblocks/bcache.c:33:3: warning: ISO C99 doesn’t
    support unnamed structs/unions [-Wc99-c11-compat]

But when sent to review Karel told out rather than getting rid of warnings
lets get rid of everything unnecessary.

[kzak@redhat.com: - use original struct member names rather than 'padN']

Reference: https://github.com/karelzak/util-linux/pull/802
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agologin: retire use of __FUNCTION__ macro
Karel Zak [Thu, 23 May 2019 19:27:37 +0000 (20:27 +0100)]
login: retire use of __FUNCTION__ macro

This fixes following warning about deprecatd __FUNCTION__ that is another
name for __func__ since GCC (pre 2.95, released July 1999).

    login-utils/login.c:860:10: warning: ISO C does not support
    ‘__FUNCTION__’ predefined identifier [-Wpedantic]

Co-Author: Sami Kerola <kerolasa@iki.fi>
Reference: https://c0x.coding-guidelines.com/6.4.2.2.html
Reference: https://github.com/karelzak/util-linux/pull/802
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoipcs: check return value when read from /proc [coverity scan]
Karel Zak [Thu, 23 May 2019 13:32:59 +0000 (15:32 +0200)]
ipcs: check return value when read from /proc [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agohwclock: don't use uninitialized value [coverity scan]
Karel Zak [Thu, 23 May 2019 13:28:07 +0000 (15:28 +0200)]
hwclock: don't use uninitialized value [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agofallocate: make posix_fadvise() use more readable for analyzers
Karel Zak [Thu, 23 May 2019 13:17:16 +0000 (15:17 +0200)]
fallocate: make posix_fadvise() use more readable for analyzers

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agodmesg: make strtok() use more robust
Karel Zak [Thu, 23 May 2019 12:18:29 +0000 (14:18 +0200)]
dmesg: make strtok() use more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoblkzone: remove never read value
Karel Zak [Thu, 23 May 2019 11:57:35 +0000 (13:57 +0200)]
blkzone: remove never read value

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agowhereis: make subdirs scan more robust
Karel Zak [Thu, 23 May 2019 11:53:00 +0000 (13:53 +0200)]
whereis: make subdirs scan more robust

* 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>
3 weeks agolsblk: make sure __process_one_device() has proper arguments [coverity scan]
Karel Zak [Thu, 23 May 2019 10:36:53 +0000 (12:36 +0200)]
lsblk: make sure __process_one_device() has proper arguments [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolsblk: check ul_path_scanf() return value [coverity scan]
Karel Zak [Thu, 23 May 2019 10:31:49 +0000 (12:31 +0200)]
lsblk: check ul_path_scanf() return value [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolsblk: check stat() return code [coverity scan]
Karel Zak [Thu, 23 May 2019 10:28:13 +0000 (12:28 +0200)]
lsblk: check stat() return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agologger: make code more robust for static analyzer [clang scan]
Karel Zak [Thu, 23 May 2019 10:14:10 +0000 (12:14 +0200)]
logger: make code more robust for static analyzer [clang scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agohardlink: avoid uninitialized variables [clang scan]
Karel Zak [Thu, 23 May 2019 10:12:07 +0000 (12:12 +0200)]
hardlink: avoid uninitialized variables [clang scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibfdisk: assert if self_pte() returns NULL
Sami Kerola [Wed, 22 May 2019 18:45:54 +0000 (19:45 +0100)]
libfdisk: assert if self_pte() returns NULL

The self_pte() can return NULL if partitions array is not large enough,
but that should also be impossible and definitely a bug.

libfdisk/src/dos.c:984:8: warning: potential null pointer dereference [-Wnull-dereference]
libfdisk/src/dos.c:1031:8: warning: potential null pointer dereference [-Wnull-dereference]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 weeks agolibfdisk: (bsd) improve checksum calculation [-Waddress-of-packed-member]
Karel Zak [Wed, 22 May 2019 15:42:48 +0000 (17:42 +0200)]
libfdisk: (bsd) improve checksum calculation [-Waddress-of-packed-member]

Let's keep compilers and static analyzers happy. The idea is to use
memcpy() to copy from buffer to variable and use all label as unsigned
char rather than vectorize by unsigned short.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibblkid: (silicon raid) improve checksum calculation [-Waddress-of-packed-member]
Karel Zak [Wed, 22 May 2019 15:42:48 +0000 (17:42 +0200)]
libblkid: (silicon raid) improve checksum calculation [-Waddress-of-packed-member]

Let's keep compilers and static analyzers happy. The idea is to use
memcpy() to copy from buffer to variable and use all label as unsigned
char rather than vectorize by uint16_t.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibfdisk: (sgi) improve checksum calculation [-Waddress-of-packed-member]
Karel Zak [Wed, 22 May 2019 15:42:48 +0000 (17:42 +0200)]
libfdisk: (sgi) improve checksum calculation [-Waddress-of-packed-member]

Let's keep compilers and static analyzers happy. The idea is to use
memcpy() to copy from buffer to variable and use all label as unsigned
char rather than vectorize by uint32_t.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoinclude/c: use __has_attribute
Karel Zak [Tue, 21 May 2019 14:27:17 +0000 (16:27 +0200)]
include/c: use __has_attribute

The __has macros are more portable (supported by gcc as well as
clang).

The old __GNUC_PREREQ is deprecated and it should be removed in
future. (Well, the __has macros are supported since gcc 5, so we
should be patient as some old stable distros (e.g. RHEL 7) use gcc
4.x).

This patch helps clang to correctly analyze our xalloc.h stuff.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agobash-completion: add hardlink completion
Sami Kerola [Mon, 20 May 2019 18:56:19 +0000 (19:56 +0100)]
bash-completion: add hardlink completion

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 weeks agobash-completion: update options before release
Sami Kerola [Mon, 20 May 2019 18:34:10 +0000 (19:34 +0100)]
bash-completion: update options before release

blkid: 5e91d5dd716ebc6144bcb0cabb0ec847a678be9e --no-part-details
lsblk: dc4662f0e755929de9cbe98b1b343b492fd620f4 --dedup
lsblk: 0bd05f5ee4876ffd13c98acd56c2bff9971f28f1 --merge
lscpu: 0e86bc8406959d0d56194d4f404b780e6b70caa4 --caches
lscpu: 2011528bce58dd31d5ee0287f2367da1f2d6cfa9 --bytes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 weeks agolib/ismounted: use xstrncpy()
Karel Zak [Mon, 20 May 2019 11:03:58 +0000 (13:03 +0200)]
lib/ismounted: use xstrncpy()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agozramctl: use xstrncpy()
Karel Zak [Mon, 20 May 2019 10:59:40 +0000 (12:59 +0200)]
zramctl: use xstrncpy()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agowhereis: use xstrncpy()
Karel Zak [Mon, 20 May 2019 10:59:02 +0000 (12:59 +0200)]
whereis: use xstrncpy()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agovipw: use xstrncpy()
Karel Zak [Mon, 20 May 2019 10:57:39 +0000 (12:57 +0200)]
vipw: use xstrncpy()

It's already used by vipw, so use it everywhere.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolib/path: use xstrncpy()
Karel Zak [Mon, 20 May 2019 10:57:16 +0000 (12:57 +0200)]
lib/path: use xstrncpy()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolib/sysfs: use xstrncpy()
Karel Zak [Mon, 20 May 2019 10:57:07 +0000 (12:57 +0200)]
lib/sysfs: use xstrncpy()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolosetup: use xstrncpy()
Karel Zak [Mon, 20 May 2019 10:46:39 +0000 (12:46 +0200)]
losetup: use xstrncpy()

Signed-off-by: Karel Zak <kzak@redhat.com>