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>
The commit ab025087f9 has disabled error
message, but unfortunately it keeps wrong return code. This has been fixed
by commit 53ae7d60cf.
This commit add hit about it to docs and fix regression test too.
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
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>
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>
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>
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>
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.htmlhttps://www.freedesktop.org/software/systemd/man/systemd-detect-virt.html#Fix: #840
Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>