safer mount output parsing
safer mount output parsing

When trying it recently on a Gentoo box (running LVM), I encountered a problem
- all the programs would exit with "No efivarfs filesystem is mounted"

Tracking this down, it turns out that the output of the mount command
contains an extra field (in Gentoo anyway) when it is an LVM mount - so
for example, I get:

# mount -l

    proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
    none on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
    udev on /dev type devtmpfs
    (rw,nosuid,relatime,size=10240k,nr_inodes=995888,mode=755)
    devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
    sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
    /dev/mapper/vg1-root on / type ext4
    (rw,noatime,discard,errors=remount-ro,data=ordered) *[root]*
    tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
    tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,mode=755)
    cgroup on /sys/fs/cgroup/systemd type cgroup
    (rw,nosuid,nodev,noexec,relatime,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
    efivarfs on /sys/firmware/efi/efivars type efivarfs
    (rw,nosuid,nodev,noexec,relatime)
    tmpfs on /tmp type tmpfs (rw)
    fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
    /dev/mapper/vg1-home on /home type ext4
    (rw,relatime,discard,data=ordered) *[home]*

Note the entries in bold ('[root]' and '[home]'). These mess up the
sscanf parsing in the kernel_variable_init() function, getting it out of
step, and ultimately meaning that it fails to recognize the efivarfs
entry. Hence the error.

The enclosed small patch fixes this, by switching the final "%*s\n" in
the sscanf to "%*[^\n]\n", which will consume anything up to the newline.

Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>

marineam/efitools,mjg59/efitools,marineam/efitools,msekletar/efitools,msekletar/efitools,msekletar/efitools,msekletar/efitools,marineam/efitools,mjg59/efitools,mjg59/efitools,mjg59/efitools,marineam/efitools