The string format is not being passed triggering:
lscpu.c: In function ‘read_hypervisor’:
lscpu.c:545:4: warning: format not a string literal and no format arguments
lscpu.c: In function ‘get_cell_header’:
lscpu.c:904:2: warning: format not a string literal and no format arguments
lscpu.c:904:2: warning: format not a string literal and no format arguments
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
We should have the most basic of checks in this library to see whether or not a block device is being used.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Since fatal() exists with a standard 1 code, it can easily be replaced by errx(3).
The xalloc lib is also introduced in this patch.
[kzak@redhat,com: - fix coding style]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
In line with previous patches, the source of a pseudofs is strictly
semantic; do not attempt to resolve it to a filesystem path.
As a side effect of this, nspec needs to be initialized to NULL since
it may not be assigned null by spec_to_devname when the FS is deemed
a pseudofs.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Similar to the previous commit, when mounting a pseudofs, trust the
source of the fs, as it cannot be matched to backing device on the
filesystem.
Similar situation, but slightly different bug:
# mkdir /foo /root/foo
# echo 'foo /foo tmpfs defaults 0 0' >> /etc/fstab
# cd /root
# mount -a
# mount | grep /foo
/root/foo on /foo type tmpfs (rw,relatime)
This fixes the pure libmount based mount utility, but the legacy mount
tool will still fail to handle this properly.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Since nodev FSs have no backing block device, it's unreasonable to try
and resolve the source back to a path on the filesystem. Always trust
the source of the FS given in /etc/fstab to avoid remounting the device
when a directory of the same name exists in the current working
directory.
Example reproduction:
# mkdir /foo
# echo 'foo /foo tmpfs defaults 0 0' >> /etc/fstab
# mount -a
# cd /root; mkdir foo
# mount -a
# mount | grep /foo
foo on /foo type tmpfs (rw,relatime)
/root/foo on /foo type tmpfs (rw,relatime)
[kzak@redhat.com: - use fs->flags to detect pseudo FS]
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
fstab:
server://foo /mnt/foo nfs user,exec
The mount(8) does not append the option "exec" to /sbin/mount.<type>
helper's command line. This is no problem when executed by non-root
user as it reads the options from fstab only.
.. but when executed by root (UID=0) then the mount.<type> helper
follows the command where the "exec" option is missing. This is bug.
original version (strace output):
execve("/sbin/mount.nfs", ["/sbin/mount.nfs",
"sr.net.home:/mnt/store", "/mnt/store", "-o",
"rw,nosuid,nodev,noauto,user"], [/* 21 vars */]) = 0
fixed version:
execve("/sbin/mount.nfs", ["/sbin/mount.nfs",
"sr.net.home:/mnt/store", "/mnt/store", "-o",
"rw,nosuid,nodev,noauto,user,exec"], [/* 21 vars */]) = 0
^^^^^
Signed-off-by: Karel Zak <kzak@redhat.com>
- improve loop_info usage (don't call ioctl more than once)
- add functions to get devno and inode of the backing file
- add function for compare any file with backing file by devno + inode
or by filename
Signed-off-by: Karel Zak <kzak@redhat.com>