libkmod: Fix open file which some char device
use lseek SEEK_CUR to get whether it is a regular file,
lseek return -ESPIPE when fd is associated with a pipe, socket, or FIFO.
commit
883d931d1bd04b089b85b554d1df6f41dcf5fbf5 upstream
("modprobe: Allow passing path to module") allow to modprobe a file,
but not handle opening a FIFO device such as modprobe /dev/tty1.
commit
8d03b6c7d990af301950d3ecdc4b5c69fa525928 uptream
("libkmod: Use pread where appropriate") fix some cases,
such as open /dev/tty1, but not for /dev/vmnet0 or /dev/userio etc.
Can be reproduced in run lshw in root and install some vm such ad vmware,
more about the case are in the Link.
Reference: https://github.com/lyonel/lshw/pull/110
Closes: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/2069649
Closes: https://bbs.deepin.org.cn/post/291466
Reported-by: Qi Xu <xuqi@uniontech.com>
Reported-by: lionheartyu <dongshengyuan@uniontech.com>
Fixes: 883d931d1bd04 ("modprobe: Allow passing path to module")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/407
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>