提交 68a9637b 编写于 作者: D Daniel P. Berrange

Make check for /dev/loop device names stricter to avoid /dev/loop-control

Recentish (2011) kernels introduced a new device called /dev/loop-control,
which causes libvirt's detection of loop devices to get confused
since it only checks for a prefix of 'loop'. Also check that the
next character is a digit
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 da13f2c7
......@@ -546,7 +546,11 @@ static int virFileLoopDeviceOpen(char **dev_name)
errno = 0;
while ((de = readdir(dh)) != NULL) {
if (!STRPREFIX(de->d_name, "loop"))
/* Checking 'loop' prefix is insufficient, since
* new kernels have a dev named 'loop-control'
*/
if (!STRPREFIX(de->d_name, "loop") ||
!c_isdigit(de->d_name[4]))
continue;
if (virAsprintf(&looppath, "/dev/%s", de->d_name) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册