]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 years agotests: add remaining stderr outputs
Karel Zak [Fri, 30 Aug 2019 14:10:01 +0000 (16:10 +0200)] 
tests: add remaining stderr outputs

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibdisk: write sample output to stdout
Karel Zak [Fri, 30 Aug 2019 14:05:50 +0000 (16:05 +0200)] 
libdisk: write sample output to stdout

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: split stdout and stderr
Karel Zak [Fri, 30 Aug 2019 13:50:07 +0000 (15:50 +0200)] 
tests: split stdout and stderr

* add $TS_ERRLOG for script stderr output
* add optional $TS_EXPECTED_ERR which points to expected/*/*.err

This change allows to keep track about stderr output from our commands
(already found bug in sfdisk...).

We do not have to depend on fragile stdout vs. stderr order (due to
different buffering semantic in different libc, etc.).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: write all message to stdout
Karel Zak [Fri, 30 Aug 2019 13:40:06 +0000 (15:40 +0200)] 
sfdisk: write all message to stdout

The code writes message to stdout and \n to stderr.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount; fix and improve read+poll mountinfo
Karel Zak [Thu, 29 Aug 2019 13:50:58 +0000 (15:50 +0200)] 
libmount; fix and improve read+poll mountinfo

* fix read() buffer size (stupid bug...)

* split read() EINTR and poll() based attempts

* use 100 attempts

* wait 10000 usec between attempts, but first 10 attempts are without
  this delay. It makes the function usable for usual use-cases as well
  as on very busy systems (successfully tested with 300 concurrent
  mount/umount processes)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: improve mountinfo reliability
Karel Zak [Wed, 28 Aug 2019 13:47:16 +0000 (15:47 +0200)] 
libmount: improve mountinfo reliability

The standard way how we read mount table is not reliable because
during the read() syscalls the table may be modified by some another
process. The changes in the table is possible to detect by poll()
event, and in this case it seems better to lseek to the begin of the file
and read it again. It's expensive, but better than races...

This patch does not modify mountinfo parser, but it reads all file to
memory (by read()+poll()) and than it creates memory stream
from the buffer and use it rather than a regular file stream.

It means the parser is still possible to use for normal files
(e.g. fstab) as well as for mountinfo and it's also portable to
systems where for some reason is no fmemopen().

Note that re-read after poll() event is limited to 5 attempts (but
successful read() without event zeroize the counter). It's because we
do not want to wait for consistent mountinfo for ever. It seems better
to use old (less reliable) way than hang up in read()+poll()
loop.

Addresses: https://github.com/systemd/systemd/issues/10872
Reported-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: use env and support both unbuffer/stdbuf
Patrick Steinhardt [Wed, 28 Aug 2019 06:56:24 +0000 (08:56 +0200)] 
tests: use env and support both unbuffer/stdbuf

Triggered by commit f612c4c67 (tests: fix --unbuffered mode with
ASAN, 2019-08-27), which says:

    Well, this patch sucks. It would be nice to have things in
    the way how it has been original expected by Patrick's patch,
    but ...

So this commit here effectively reverts it and instead tries to
improve the shortcomings of the original patch. First, it uses
env(1) to set ASAN_OPTIONS instead of directly adding it to the
args array to fix execution of "${args[@]}" "$@".

Second, it now supports both unbuffer(1) and stdbuf(1). The
latter uses LD_PRELOAD tricks, which doesn't play nicely with
ASAN, so it will not be used if ASAN has been requested. It's
still valuable to have support for both, as many more systems
will have stdbuf(1) from coreutils installed but not unbuffer(1)
from expect.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: don't show diff for TS_KNOWN_FAIL
Karel Zak [Tue, 27 Aug 2019 12:38:21 +0000 (14:38 +0200)] 
tests: don't show diff for TS_KNOWN_FAIL

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: improve unbuffer check
Karel Zak [Tue, 27 Aug 2019 12:28:11 +0000 (14:28 +0200)] 
tests: improve unbuffer check

* remove obsolete stdbuf check

* check for unbuffer command in ts_run() than skip all test

Reported-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: (fdisk) avoid hardcoding of errno string
Patrick Steinhardt [Fri, 23 Aug 2019 13:32:58 +0000 (15:32 +0200)] 
tests: (fdisk) avoid hardcoding of errno string

The test fdisk/oddinput hardcodes strings returned by strerror(3P) for
both the errors ENOENT and ENOTTY. As these strings are unportable,
convert the tests to use the test_strerror helper instead to convert
them with sed(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 years agotests: fix --unbuffered mode with ASAN
Karel Zak [Tue, 27 Aug 2019 11:02:38 +0000 (13:02 +0200)] 
tests: fix --unbuffered mode with ASAN

Unfortunately, ASAN is pretty sensitive to LD_PRELOAD, but stdbuf from
coreutils is based on LD_PRELOAD. So, I have replaced stdbuf with
unbuffer (from expect pkg).

The another problem is "${args[@]}" "$@" which does not work as expected.

Well, this patch sucks. It would be nice to have things in the way
how it has been original expected by Patrick's patch, but ...

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch '2019wk33' of https://github.com/kerolasa/util-linux
Karel Zak [Tue, 27 Aug 2019 08:11:02 +0000 (10:11 +0200)] 
Merge branch '2019wk33' of https://github.com/kerolasa/util-linux

* '2019wk33' of https://github.com/kerolasa/util-linux:
  docs: try to find broken man references and fix them
  docs: correct su.1 runuser reference from section 8 to 1
  po: remove possibility to translate static option arguments

4 years agotests: (col) avoid hardcoding of errno string
Patrick Steinhardt [Fri, 23 Aug 2019 13:32:57 +0000 (15:32 +0200)] 
tests: (col) avoid hardcoding of errno string

The col/multibyte test has a hardcoded error string as part of its
expected output that is returned by glibc's strerror(3P) function. Even
though many of these strings are the same across libc implementations,
they are not standardiced and some are certainly different. One example
is the string for EILSEQ on musl libc.

To fix this, we introduce a new test helper "test_strerror". The helper
can be invoked with an error code like "EILSEQ", which will cause it to
print out the the respective error message for that code. Note that
"test_strerror" cannot act on the error's value (e.g. 84 for EILSEQ), as
these aren't standardized either. Instead, we thus need to have an array
of the error's string representation ("EILSEQ") to its respective error
code (the define EILSEQ). The array can trivially be extended as
required, thus it is only sparsely populated with EILSEQ right now.

To fix the col/multibyte test, we introduce a call to sed(1) to replace
the strerror(3P) message from EILSEQ with "EILSEQ". Furthermore, as
we're running tests with the POSIX locale by default which treats all
bytes as valid multibyte sequences, we have to change to the C.UTF-8
locale instead to actually get an error.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 years agotests: (column) use actually invalid multibytes to test encoding
Patrick Steinhardt [Fri, 23 Aug 2019 13:32:56 +0000 (15:32 +0200)] 
tests: (column) use actually invalid multibytes to test encoding

If reading an invalid multibyte sequence, column(1) will encode the byte
as "\x<hex>" instead. The tests try to verify that by piping "£" into
column(1). As the tests run with LC_ALL=POSIX by default, though, libc
implementations strictly adhering to the POSIX standard will treat all
characters as valid multibyte characters. As a consequence, no EILSEQ is
raised by mbtowc(3P) and the character is not encoded as hex, breaking
the test.

Fix this by setting LC_ALL=C.UTF-8. As "£" is a valid UTF-8 character,
we also change the test to use a proper illegal multibyte sequence.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 years agotests: (colcrt) fix reliance on EILSEQ in POSIX locale
Patrick Steinhardt [Fri, 23 Aug 2019 13:32:55 +0000 (15:32 +0200)] 
tests: (colcrt) fix reliance on EILSEQ in POSIX locale

The input file "crash1" in the colcrt/regressions test contains the
illegal byte sequence "\x94\x7e". While "\x7e" is '~', "\x94" is not a
valid character. Thus, the test assumes that getwc(3P) will return
`WEOF` and set `errno=EILSEQ`, causing colcrt(1) to abort reading the
stream and thus not print the trailing '~'.

This assumption holds just fine for glibc as it will dutifully report
EILSEQ, but musl libc will happily read the complete stream without
complaining about the illegal character. But in fact, as tests run with
LC_ALL=POSIX by default, glibc's behaviour is wrong while musl is right.
Quoting mbrtowc(3P) from POSIX.1-2017:

    [EILSEQ] An invalid character sequence is detected. In the POSIX locale an
             [EILSEQ] error cannot occur since all byte values are valid
             characters.

Fix the issue by running the colcrt tests with C.UTF8 locale.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 years agotests: (libfdisk) remove reliance on buffer behaviour of standard streams
Patrick Steinhardt [Fri, 23 Aug 2019 13:32:54 +0000 (15:32 +0200)] 
tests: (libfdisk) remove reliance on buffer behaviour of standard streams

The tests in libfdisk/mkpart-full all rely on the buffering behaviour of
standard output and standard error streams, most importantly that stderr
is non-buffering and stdout is buffering. This doesn't hold on all libc
implementations when redirecting to a file, breaking the test suite on
such platforms.

Use `ts_run --unbuffered` to stop buffering of the standard output
stream to fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 years agotests: remove reliance on buffer behaviour of stderr/stdout streams
Patrick Steinhardt [Fri, 23 Aug 2019 13:32:53 +0000 (15:32 +0200)] 
tests: remove reliance on buffer behaviour of stderr/stdout streams

In the test cases "rename::exit_codes" and "rename::exit_codes", we rely
on the flushing behaviour of stderr and stdout streams relative to each
other. Streams in glibc will not flush on newlines if stdout is pointing
to a non-TTY file descriptor, but relying on this is fragile and may
break on systems with a different behaviour like musl libc.

Fix this by introducing a new parameter "--unbuffered" to `ts_run`. If
this parameter is passed and stdbuf(1) from coreutils is available, then
it will use it to disable buffering of standard output completely. Like
this, we can selectively run tests with this if ordering of messages
from stdout and stderr is being checked.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
x

4 years agosys-utils/manuals: Make the number of the paired macros ".RS" and ".RE" equal
Bjarni Ingi Gislason [Mon, 26 Aug 2019 19:05:01 +0000 (19:05 +0000)] 
sys-utils/manuals: Make the number of the paired macros ".RS" and ".RE" equal

  Adjust the number of the macros ".RS" and ".RE" to be equal.

  There is no change in the formatted output.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
4 years agodocs: try to find broken man references and fix them
Sami Kerola [Sat, 24 Aug 2019 21:34:16 +0000 (22:34 +0100)] 
docs: try to find broken man references and fix them

Unfortunately methods I used to find and fix were based on quite manual
process that cannot be easily repeated so I do not see how this fix could be
turned into a tools/checkmans.sh addition.  Well, lets hope doing this
manually twice every decade is good enough.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agodocs: correct su.1 runuser reference from section 8 to 1
Sami Kerola [Wed, 21 Aug 2019 20:18:21 +0000 (21:18 +0100)] 
docs: correct su.1 runuser reference from section 8 to 1

Addresses: https://bugs.debian.org/929677
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agopo: remove possibility to translate static option arguments
Sami Kerola [Wed, 21 Aug 2019 19:25:31 +0000 (20:25 +0100)] 
po: remove possibility to translate static option arguments

These strings are expected to be wrote exactly as they are parsed, so make
translating them impossible.  Since mkfs.cramfs -N option arguments need
this treatment use opportunity to slice usage() output to multiple lines.

Addresses: https://bugs.debian.org/907568
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoMerge branch 'fix-ger-translation-chrt-help' of https://github.com/Thermi/util-linux
Karel Zak [Fri, 23 Aug 2019 10:32:06 +0000 (12:32 +0200)] 
Merge branch 'fix-ger-translation-chrt-help' of https://github.com/Thermi/util-linux

* 'fix-ger-translation-chrt-help' of https://github.com/Thermi/util-linux:
  Fix -n to -b in German help message

4 years agolibfidk: (dos) fix tiny partitions calculation
Karel Zak [Thu, 22 Aug 2019 12:00:32 +0000 (14:00 +0200)] 
libfidk: (dos) fix tiny partitions calculation

The code uses last_sector -= 1 for tiny partitions. This does not make
sense. This stupidity has been introduced by (my) badly commented commit
09a4ca5e450c5e7cbe860453b76fd68c60fe591f ... sorry.

Fortunately, this issue is visible only for tiny partitions on large
devices (partitions where size < grain; usual grain is 1MiB) if the last
sector is specified by relative notation (+size{siffix}).

Note that "last -= 1" makes sense when the "last" is align to the
optimal I/O boundary; in this case we need to set the end of the
partition one sector before the boundary. For tiny devices it does not
makes sense as we do not align these partitions.

Addresses: https://github.com/karelzak/util-linux/issues/843
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoeject: use O_EXCL on default
Karel Zak [Thu, 22 Aug 2019 11:05:06 +0000 (13:05 +0200)] 
eject: use O_EXCL on default

* by default we assume all is umounted; so O_EXCL is no problem,
  otherwise there is bug or race (someone else remounted the device)...

* --force and --no-umount disable O_EXCL

Addresses: https://github.com/karelzak/util-linux/issues/423
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoFix -n to -b in German help message
Noel Kuntze [Thu, 22 Aug 2019 07:02:49 +0000 (09:02 +0200)] 
Fix -n to -b in German help message

4 years agoinclude/xalloc: reindent function bodies to unify indentation
Sami Kerola [Sun, 18 Aug 2019 10:11:00 +0000 (11:11 +0100)] 
include/xalloc: reindent function bodies to unify indentation

The file used unusual 7 spaces indent step in some of the functions.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoinclude/xalloc: use multiline function declarations
Sami Kerola [Sun, 18 Aug 2019 10:03:44 +0000 (11:03 +0100)] 
include/xalloc: use multiline function declarations

There are two things happening in this commit.  1) Move each function
attribute to it's own line 2) move function return value after attributes so
that function inputs and outputs are on same line.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agosetpwnam: use more appropriate allocation size types
Sami Kerola [Sun, 18 Aug 2019 09:29:32 +0000 (10:29 +0100)] 
setpwnam: use more appropriate allocation size types

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agocolumn: pass control struct to local_wcstok()
Sami Kerola [Sat, 17 Aug 2019 20:05:39 +0000 (21:05 +0100)] 
column: pass control struct to local_wcstok()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoMerge branch 'container' of https://github.com/slashdd/util-linux
Karel Zak [Wed, 21 Aug 2019 12:37:26 +0000 (14:37 +0200)] 
Merge branch 'container' of https://github.com/slashdd/util-linux

* 'container' of https://github.com/slashdd/util-linux:
  fstrim shouldn't run inside a container

4 years agopartx: document -d vs. --nr and fix test
Karel Zak [Wed, 21 Aug 2019 11:42:22 +0000 (13:42 +0200)] 
partx: document -d vs. --nr and fix test

The commit ab025087f91b66ee8e23a16bc49eb0d9bd421d65 has disabled error
message, but unfortunately it keeps wrong return code. This has been fixed
by commit 53ae7d60cfeacd4e87bfe6fcc015b58b78ef4555.

This commit add hit about it to docs and fix regression test too.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopartx: don't report ENXIO as error on -d
Karel Zak [Wed, 21 Aug 2019 08:51:18 +0000 (10:51 +0200)] 
partx: don't report ENXIO as error on -d

The errno ENXIO should be ignored, unfortunately the current code uses
variable 'rc' for ioctl return code as well as for final del_parts()
return value. So, failed ioctl (which should be ignored) affects all
del_parts() status.

  # modprobe scsi_debug dev_size_mb=100
  # partx  -d --nr 1-1024 /dev/sdc; echo $?
  1

The device dos not contains any partitions, so 0 return code is
expected in this case.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1739179
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: fix comment referring to passno field
Patrick Steinhardt [Thu, 15 Aug 2019 10:50:05 +0000 (12:50 +0200)] 
libmount: fix comment referring to passno field

There's an obvious copy-paste error in `mnt_parse_table_line` when
referring to the 6th field of the fstab format, where it says "freq"
instead of "passno". This has probably been copied from the 5th field,
which is in fact correctly labelled as "freq".

Fix the mistake by changing the comment to say "passno" instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 years agowdctl: remove duplicate include of <unistd.h>
Patrick Steinhardt [Thu, 15 Aug 2019 12:03:23 +0000 (14:03 +0200)] 
wdctl: remove duplicate include of <unistd.h>

The <unistd.h> header is included twice in "wdctl.c". Remove one
of these includes to keep "make checkincludes" happy.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 years agolibmount: Keep the mnt_tab info for the existent dest in mnt_copy_fs()
Kevin Hao [Mon, 19 Aug 2019 08:30:22 +0000 (16:30 +0800)] 
libmount: Keep the mnt_tab info for the existent dest in mnt_copy_fs()

The "umount -f -a -r" get stuck in a endless loop when run with a
mountinfo like below:
  15 0 179:2 / / ro,relatime - ext4 /dev/root ro
  16 15 0:6 / /dev rw,relatime - devtmpfs devtmpfs rw,size=242896k,nr_inodes=60724,mode=755
  17 15 0:4 / /proc rw,relatime - proc proc rw
  18 15 0:15 / /mnt/.psplash rw,relatime - tmpfs tmpfs rw,size=40k
  19 15 0:16 / /sys rw,relatime - sysfs sysfs rw
  20 19 0:7 / /sys/kernel/debug rw,relatime - debugfs debugfs rw
  21 15 0:17 / /run rw,nosuid,nodev - tmpfs tmpfs rw,mode=755
  22 15 0:18 / /var/volatile rw,relatime - tmpfs tmpfs rw
  23 15 179:1 / /boot rw,relatime - vfat /dev/mmcblk0p1 rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
  24 16 0:19 / /dev/pts rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
  25 18 0:20 / /mnt/.psplash rw,relatime - tmpfs tmpfs rw,size=40k

The reason is that the two same mnt entry "/mnt/.psplash" will cause
the dst->tab set to NULL when umount this mnt entry the second time.
This will trigger an endless loop in mnt_reset_table() because that
mnt entry is linked on the libmnt_table but its .tab is set to NULL.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
4 years agotests: Skip fdisk/mbr-nondos-mode on Sparc as unsupported
Karel Zak [Mon, 19 Aug 2019 12:28:50 +0000 (14:28 +0200)] 
tests: Skip fdisk/mbr-nondos-mode on Sparc as unsupported

The test has been originally designed as usable on sparc, but now we
use it for many features which are MBR specific.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Co-Author: Anatoly Pugachev <matorola@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agochfn: don't append extra tailing commas
Karel Zak [Mon, 19 Aug 2019 12:03:07 +0000 (14:03 +0200)] 
chfn: don't append extra tailing commas

 # grep kzak /etc/passwd
 kzak:x:1000:1000::/home/kzak:/bin/bash

 # chfn kzak
 ...
 grep kzak /etc/passwd

old version:
 kzak:x:1000:1000:Karel Zak,,,,:/home/kzak:/bin/bash

fixed version:
 kzak:x:1000:1000:Karel Zak:/home/kzak:/bin/bash

Reported-by: Filip Dvorak <fdvorak@redhat.com>
References: f723cbf544a7eac2927634f2cb6d802437a2d519
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofstrim shouldn't run inside a container
Eric Desrochers [Wed, 14 Aug 2019 16:58:39 +0000 (12:58 -0400)] 
fstrim shouldn't run inside a container

Container type implies the following products:
openvz OpenVZ/Virtuozzo
lxc Linux container implementation by LXC
lxc-libvirt Linux container implementation by libvirt
systemd-nspawn systemd's minimal container implementation, see systemd-nspawn(1)
docker Docker container manager
podman Podman container manager
rkt rkt app container runtime
wsl Windows Subsystem for Linux

References:
https://www.freedesktop.org/software/systemd/man/systemd.unit.html
https://www.freedesktop.org/software/systemd/man/systemd-detect-virt.html#

Fix: #840

Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
4 years agoRemove unused utime.h header
Rosen Penev [Thu, 8 Aug 2019 19:14:39 +0000 (12:14 -0700)] 
Remove unused utime.h header

It is sometimes unavailable and errors on inclusion. For example, when
disabled in uClibc-ng.

4 years agoRemove isascii usage
Rosen Penev [Thu, 8 Aug 2019 19:12:55 +0000 (12:12 -0700)] 
Remove isascii usage

There is a c_isascii function that can be used.

isascii is deprecated and not available with some libcs like uClibc-ng
where it can be compile time disabled.

4 years agotests: update fdisk output
Karel Zak [Thu, 8 Aug 2019 12:20:05 +0000 (14:20 +0200)] 
tests: update fdisk output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (script) support shortcuts in the type= field
Karel Zak [Thu, 8 Aug 2019 08:34:27 +0000 (10:34 +0200)] 
libfdisk: (script) support shortcuts in the type= field

The unnamed-field format supports partition type shortcuts:

",1MiB,L'

but for named-field format it requires full type:

 (mbr) "size=1MiB,type=83"
 (gpt)  "size=1MiB,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"

This patch implements type shortcuts also for named-field format:

"size=1MiB,type=L"

to make it more user-friendly and unified.

Addresses: https://github.com/karelzak/util-linux/issues/837
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: use subtests for mountpoint(1)
Karel Zak [Wed, 7 Aug 2019 09:45:57 +0000 (11:45 +0200)] 
tests: use subtests for mountpoint(1)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'issue832' of https://github.com/kerolasa/util-linux
Karel Zak [Wed, 7 Aug 2019 09:20:21 +0000 (11:20 +0200)] 
Merge branch 'issue832' of https://github.com/kerolasa/util-linux

* 'issue832' of https://github.com/kerolasa/util-linux:
  mountpoint: add --nofollow option

4 years agoMerge branch 'master' of https://github.com/chstarkd/util-linux
Karel Zak [Wed, 7 Aug 2019 09:16:14 +0000 (11:16 +0200)] 
Merge branch 'master' of https://github.com/chstarkd/util-linux

* 'master' of https://github.com/chstarkd/util-linux:
  removed double space
  fixed mount man page typo, "bythe" -> "by the"

4 years agolibfdisk: refer to partx(8) rather than to kpartx(8)
Karel Zak [Tue, 6 Aug 2019 10:24:33 +0000 (12:24 +0200)] 
libfdisk: refer to partx(8) rather than to kpartx(8)

Reported-by: Petr Pisar <petr.pisar@atlas.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoremoved double space
Chistyj Arkadij [Sun, 4 Aug 2019 18:21:55 +0000 (21:21 +0300)] 
removed double space

4 years agofixed mount man page typo, "bythe" -> "by the"
Chistyj Arkadij [Sun, 4 Aug 2019 14:06:38 +0000 (17:06 +0300)] 
fixed mount man page typo, "bythe" -> "by the"

4 years agomountpoint: add --nofollow option
Sami Kerola [Fri, 2 Aug 2019 18:39:05 +0000 (19:39 +0100)] 
mountpoint: add --nofollow option

The no follow option will allow user to distinct mount points from symbolic
links pointing to them.  Arguably this is pretty pedantic option, mounting a
device or bind mount to a directory via symlink does not have or cause any
issues.

Addresses: https://github.com/karelzak/util-linux/issues/832
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agodmesg: fix output hex encoding
Karel Zak [Thu, 1 Aug 2019 09:43:58 +0000 (11:43 +0200)] 
dmesg: fix output hex encoding

The current code ignores single-byte non-printable characters.

Reported-by: Marc Deslauriers <marc.deslauriers@canonical.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agochoom: improve docs
Karel Zak [Thu, 1 Aug 2019 09:06:06 +0000 (11:06 +0200)] 
choom: improve docs

It's not obvious from the current docs that you have to explicitly
split command line options and wanted commands.

Addresses: https://github.com/karelzak/util-linux/issues/833
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: fix file descriptor leak in blkid_verify()
Karel Zak [Wed, 31 Jul 2019 14:18:27 +0000 (16:18 +0200)] 
libblkid: fix file descriptor leak in blkid_verify()

The function blkid_verify() uses private device file descriptor and
uses blkid_probe_set_device() to assign the descriptor to low-level
probing code. Unfortunately, close() in this case is not enough as the
prober can internally open whole-disk device too.

The library API has been extended so blkid_probe_set_device()
deallocates and close previously used prober for whole-disk. This new
functionality is used in blkid_verify() now.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1734545
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch '2019wk29' of https://github.com/kerolasa/util-linux
Karel Zak [Mon, 29 Jul 2019 09:13:51 +0000 (11:13 +0200)] 
Merge branch '2019wk29' of https://github.com/kerolasa/util-linux

* '2019wk29' of https://github.com/kerolasa/util-linux:
  lscpu: prefer memcpy() to manual pointer arithmetic

4 years agocolumn: fix outputing empty column at the end of line
Yousong Zhou [Mon, 29 Jul 2019 01:24:29 +0000 (01:24 +0000)] 
column: fix outputing empty column at the end of line

The following commands manifests the problem.  In old versions before
commit 4762ae9d60 ("column: use libsmartcols for --table"), both of them
should output with 2 "|"

echo '||'  | column -o '|' -s '|' -t
echo '|| ' | column -o '|' -s '|' -t

Fixes: 4762ae9d60 ("column: use libsmartcols for --table")
Signed-off-by: Yousong Zhou <zhouyousong@yunionyun.com>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
4 years agolscpu: prefer memcpy() to manual pointer arithmetic
Sami Kerola [Sat, 27 Jul 2019 17:55:01 +0000 (18:55 +0100)] 
lscpu: prefer memcpy() to manual pointer arithmetic

With pointer arithmetic clang address sanitizer gives following error this
change addresses.  Notice the following happens only when running as root.

sys-utils/lscpu-dmi.c:83:14: runtime error: load of misaligned address
0x55a1d62f3d1d for type 'const uint16_t' (aka 'const unsigned short'), which
requires 2 byte alignment

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolscpu: (man) add note about cache sizes
Karel Zak [Thu, 25 Jul 2019 10:23:59 +0000 (12:23 +0200)] 
lscpu: (man) add note about cache sizes

Addresses: https://github.com/karelzak/util-linux/issues/827
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoagetty: simplify code in dolog() preprocessor blocks
Sami Kerola [Sun, 21 Jul 2019 20:36:28 +0000 (21:36 +0100)] 
agetty: simplify code in dolog() preprocessor blocks

Aim is to make dolog() a lot more readable and understandable, with downside
of when (rarely?) USE_SYSLOG it not defined the function will use a bit more
space from stack.  I think that is price well worth paying.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agologin: simplify string handling
Sami Kerola [Sun, 21 Jul 2019 18:12:03 +0000 (19:12 +0100)] 
login: simplify string handling

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolast: replace strncat() with more robust mem2strcpy()
Sami Kerola [Sat, 20 Jul 2019 10:11:01 +0000 (11:11 +0100)] 
last: replace strncat() with more robust mem2strcpy()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agotests: (fdisk) update padding in output
Karel Zak [Tue, 23 Jul 2019 14:35:20 +0000 (16:35 +0200)] 
tests: (fdisk) update padding in output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: (libsmartcols) add padding tests
Karel Zak [Tue, 23 Jul 2019 14:26:48 +0000 (16:26 +0200)] 
tests: (libsmartcols) add padding tests

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibsmartcols: cleanup and extend padding functionality
Karel Zak [Tue, 23 Jul 2019 14:04:51 +0000 (16:04 +0200)] 
libsmartcols: cleanup and extend padding functionality

LIBSMARTCOLS_DEBUG_PADDING=on in the next examples forces libsmartcols
print '.' as a padding char. See line "ffff" in the exmaples.

* default output is to fill all except last cell

$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
NAME.. ......NUM STRINGS STRINGS
aaaa.. ........0 aaaa... aaaa
bbb... ......100 bbb.... bbb
ccccc. .......21 ccccc.. ccccc
dddddd ........3 dddddd. dddddd
ee.... ......411 ee..... ee
ffff.. .....5111 .......
gggggg 678993321 gggggg. gggggg
hhh... ..7666666 hhh.... hhh

* scols_table_enable_minout() minimizes output for tailing empty cells, example:

$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --minout  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
NAME.. ......NUM STRINGS STRINGS
aaaa.. ........0 aaaa... aaaa
bbb... ......100 bbb.... bbb
ccccc. .......21 ccccc.. ccccc
dddddd ........3 dddddd. dddddd
ee.... ......411 ee..... ee
ffff.. .....5111
gggggg 678993321 gggggg. gggggg
hhh... ..7666666 hhh.... hhh

* cleanup up scols_table_enable_maxout() use, example:

$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --maxout  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
NAME.............. ..................NUM STRINGS............ STRINGS............
aaaa.............. ....................0 aaaa............... aaaa...............
bbb............... ..................100 bbb................ bbb................
ccccc............. ...................21 ccccc.............. ccccc..............
dddddd............ ....................3 dddddd............. dddddd.............
ee................ ..................411 ee................. ee.................
ffff.............. .................5111 ................... ...................
gggggg............ ............678993321 gggggg............. gggggg.............
hhh............... ..............7666666 hhh................ hhh................

Note that we cannot make scols_table_enable_minout() default because
for example "column --table" is pretty commonly used with non-blank
columns separator and in this case all cells has to be filled.

$ echo -e "aa,b,ccc\na,,\naaa,bbb,ccc" |  column --table --separator ',' --output-separator '|'
aa |b  |ccc
a  |   |
aaa|bbb|ccc

Addresses: https://github.com/karelzak/util-linux/issues/826
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: improve partition copy on resize
Karel Zak [Mon, 22 Jul 2019 10:09:38 +0000 (12:09 +0200)] 
libfdisk: improve partition copy on resize

It seems pretty fragile to copy also reference counting and reference
to table list.

Addresses: https://github.com/karelzak/util-linux/pull/822
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: (drbd) fix comment formatting
Karel Zak [Mon, 22 Jul 2019 09:49:45 +0000 (11:49 +0200)] 
libblkid: (drbd) fix comment formatting

... to avoid misinterpretation by gtk-docs.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'master_fix-partition-copy' of https://github.com/vojtechtrefny/util...
Karel Zak [Mon, 22 Jul 2019 09:35:12 +0000 (11:35 +0200)] 
Merge branch 'master_fix-partition-copy' of https://github.com/vojtechtrefny/util-linux

4 years agofstrim: fix systemd service protection
Karel Zak [Mon, 22 Jul 2019 09:10:30 +0000 (11:10 +0200)] 
fstrim: fix systemd service protection

ProtectHome=yes makes /home inaccessible, but we need to open the
directories (mountpoints) read-only.

Addresses: https://github.com/karelzak/util-linux/issues/824
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: Fix double free of *_chs strings in fdisk_partition
Vojtech Trefny [Fri, 19 Jul 2019 11:35:11 +0000 (13:35 +0200)] 
libfdisk: Fix double free of *_chs strings in fdisk_partition

__copy_partition doesn't duplicate these strings which leads to
occasional double free.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
4 years agolibfdisk: don't use NTFS as MBR
Karel Zak [Wed, 17 Jul 2019 10:42:39 +0000 (12:42 +0200)] 
libfdisk: don't use NTFS as MBR

Same as 7c643ed2855058657798d9e8e80701023de14a08.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: do not interpret NTFS as MBR
Karel Zak [Wed, 17 Jul 2019 10:35:45 +0000 (12:35 +0200)] 
libblkid: do not interpret NTFS as MBR

 # mkntfs -Q -F /dev/sdc

old version:
 # ./blkid -p /dev/sdc
 /dev/sdc: UUID="0E9E8C5F2F718479" TYPE="ntfs" USAGE="filesystem" PTTYPE="dos"

new version:
 # ./blkid -p /dev/sdc
 /dev/sdc: UUID="0E9E8C5F2F718479" TYPE="ntfs" USAGE="filesystem"

Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: don't use FAT as MBR
Karel Zak [Wed, 17 Jul 2019 10:11:38 +0000 (12:11 +0200)] 
libfdisk: don't use FAT as MBR

The current libfdisk MBR detection is too weak, the result is that it
reuses MBR from FAT. The correct behavior is to create a new MBR, wipe
first sector (on write) and warn about obsolete FAT superblock.

Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: improve hwclock CMOS dependences
Karel Zak [Mon, 15 Jul 2019 13:32:49 +0000 (15:32 +0200)] 
build-sys: improve hwclock CMOS dependences

Let's use standard UL_* macros to check for dependencies
(architectures and hwclock).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: add UL_REQUIRES_ARCH()
Karel Zak [Mon, 15 Jul 2019 13:31:40 +0000 (15:31 +0200)] 
build-sys: add UL_REQUIRES_ARCH()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohwclock: use CMOS clock only if available
Carlos Santos [Wed, 3 Jul 2019 16:31:34 +0000 (13:31 -0300)] 
hwclock: use CMOS clock only if available

- Add --disable-hwclock-cmos configuration argument
- Add USE_HWCLOCK_CMOS (enabled by default for i386/x86_64)
- Add define(USE_HWCLOCK_CMOS)
- Compile hwclock-cmos.c only if USE_HWCLOCK_CMOS is true
- Remove all unnecessary #ifdefs from hwclock-cmos.c
- Add #ifdef USE_HWCLOCK_CMOS around the determine_clock_access_method()
  call in hwclock.c

Signed-off-by: Carlos Santos <unixmania@gmail.com>
4 years agotests: (libmount) make X-* and x-* more robust
Karel Zak [Mon, 15 Jul 2019 10:46:11 +0000 (12:46 +0200)] 
tests: (libmount) make X-* and x-* more robust

Addresses: https://github.com/karelzak/util-linux/issues/818
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsblk: fix -E segfault
Karel Zak [Mon, 15 Jul 2019 10:28:26 +0000 (12:28 +0200)] 
lsblk: fix -E segfault

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>
4 years agolibblkid: (drbd) simplify padding
Karel Zak [Mon, 15 Jul 2019 10:07:42 +0000 (12:07 +0200)] 
libblkid: (drbd) simplify padding

We do not need all the metadata and it seems the extra padding is
problematic in some cases. Let's keep is simple and use fixed offset
for the metadata rather than sizeof().

References: https://github.com/karelzak/util-linux/pull/820
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch '2019wk27' of https://github.com/kerolasa/util-linux
Karel Zak [Mon, 15 Jul 2019 09:37:17 +0000 (11:37 +0200)] 
Merge branch '2019wk27' of https://github.com/kerolasa/util-linux

* '2019wk27' of https://github.com/kerolasa/util-linux:
  libblkid: fix address sanitizer issues
  libblkid: check number of test_blkid_save arguments correctly
  include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute
  libmount: fix potential null pointer dereference
  libfdisk: fix variable shadowing
  lib/ttyutils: avoid checking same thing twice

4 years agobuild-sys: Include <stdlib.h> in ./configure wchar_t test
Florian Weimer [Fri, 5 Jul 2019 15:20:27 +0000 (17:20 +0200)] 
build-sys: Include <stdlib.h> in ./configure wchar_t test

Without #include <stdlib.h>, this configure check fails for strict
C99/C11 compilers which do not support implicit function declarations
(which are a C90 feature removed from C99).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: fix address sanitizer issues
Sami Kerola [Sun, 14 Jul 2019 09:17:32 +0000 (10:17 +0100)] 
libblkid: fix address sanitizer issues

With aligned attribute many blkid tests fail with following error.  So
instead of aligning to 4K add padding that makes the struct same size
without causing asan trip over.

    libblkid/src/superblocks/drbd.c:179:6: runtime error: member access
    within misaligned address 0x55913d7e6958 for type 'struct
    meta_data_on_disk_9', which requires 4096 byte alignment

In zfs structure it seems compiler is adding padding, that does not mix well
with be32_to_cpu() and other bit operations.

    libblkid/src/superblocks/zfs.c:109:23: runtime error: load of misaligned
    address 0x7ff6406540e4 for type 'uint32_t' (aka 'unsigned int'), which
    requires 8 byte alignment

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolibblkid: check number of test_blkid_save arguments correctly
Sami Kerola [Sat, 13 Jul 2019 08:31:06 +0000 (09:31 +0100)] 
libblkid: check number of test_blkid_save arguments correctly

Without this running test_blkid_save without arguments will cause a crash
when strdup() refers to none-exiting file name.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoinclude/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute
Sami Kerola [Fri, 12 Jul 2019 21:28:10 +0000 (22:28 +0100)] 
include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute

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>
4 years agolibmount: fix potential null pointer dereference
Sami Kerola [Fri, 12 Jul 2019 20:56:52 +0000 (21:56 +0100)] 
libmount: fix potential null pointer dereference

This is false positive warning, but lets silence it so that if and when
warnings crop up they are easy to notice and take seriously.

libmount/src/optstr.c:354:29: warning: potential null pointer dereference
[-Wnull-dereference]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolibfdisk: fix variable shadowing
Sami Kerola [Fri, 12 Jul 2019 20:45:50 +0000 (21:45 +0100)] 
libfdisk: fix variable shadowing

libfdisk/src/context.c:678:7: warning: declaration of ‘rc’ shadows a
previous local [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolib/ttyutils: avoid checking same thing twice
Sami Kerola [Mon, 1 Jul 2019 21:02:06 +0000 (22:02 +0100)] 
lib/ttyutils: avoid checking same thing twice

Check cols and lines are not NULL only once.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolsblk: force to print PKNAME for partition
Karel Zak [Thu, 27 Jun 2019 07:22:18 +0000 (09:22 +0200)] 
lsblk: force to print PKNAME for partition

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>
4 years agoTODO: fix typo
Sanchit Saini [Fri, 21 Jun 2019 17:51:46 +0000 (23:21 +0530)] 
TODO: fix typo

4 years agoFix translations for losetup typo fix
Stanislav Brabec [Thu, 20 Jun 2019 21:42:40 +0000 (23:42 +0200)] 
Fix translations for losetup typo fix

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agolosetup: Typo fix
Stanislav Brabec [Thu, 20 Jun 2019 21:41:30 +0000 (23:41 +0200)] 
losetup: Typo fix

Fix a typo in usage introduced in a1a41597bf.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agoagetty: Remove superfluous fflush()
Stanislav Brabec [Thu, 20 Jun 2019 20:16:42 +0000 (22:16 +0200)] 
agetty: Remove superfluous fflush()

eval_issue_file() contains fflush(stdout). It comes from an old code that
used fputs() to write to the console.

In the new code, we write to a temporary memstream, and
fclose(ie->output) fully replaces possible fflush(ie->output) in this
implementation.

The new print_issue_file() does not need it as well, as it uses
unbuffered write_all().

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agolibfdisk: fix typos
Marcos Mello [Thu, 20 Jun 2019 11:22:25 +0000 (08:22 -0300)] 
libfdisk: fix typos

4 years agoRevert "lib/loopdev.c: Inline loopcxt_has_device"
Karel Zak [Tue, 18 Jun 2019 20:05:16 +0000 (22:05 +0200)] 
Revert "lib/loopdev.c: Inline loopcxt_has_device"

... no caller in that file, this change has no effect.

This reverts commit 3bb960c7b5f1428f1bff885b2667787e8af5001b.

4 years agolibfdisk: add fdisk_assign_device_by_fd()
Karel Zak [Tue, 18 Jun 2019 11:30:42 +0000 (13:30 +0200)] 
libfdisk: add fdisk_assign_device_by_fd()

It's possible that caller has the device already opened for some
other task, so let's reuse the file descriptor.

Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'su_err_msg' of https://github.com/jhrozek/util-linux
Karel Zak [Tue, 18 Jun 2019 09:26:12 +0000 (11:26 +0200)] 
Merge branch 'su_err_msg' of https://github.com/jhrozek/util-linux

* 'su_err_msg' of https://github.com/jhrozek/util-linux:
  su: More descriptive error message on malformed user entry

4 years agoMerge branch 'topic/wdctl'
Karel Zak [Mon, 17 Jun 2019 13:48:28 +0000 (15:48 +0200)] 
Merge branch 'topic/wdctl'

4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>