提交 efdb9117 编写于 作者: P Peter Krempa

qemu: Fix starting of VMs with empty CDROM drives

Since 24e5cafb (thankfully unreleased)
when a VM with an empty disk drive would be started the code would call
stat() on NULL path as a check was missing from the callback rendering
machines unstartable.

Report success when the path is empty (denoting an empty drive).
上级 15e38ebb
...@@ -343,6 +343,9 @@ qemuSecurityChownCallback(virStorageSourcePtr src, ...@@ -343,6 +343,9 @@ qemuSecurityChownCallback(virStorageSourcePtr src,
if (virStorageSourceIsLocalStorage(src)) { if (virStorageSourceIsLocalStorage(src)) {
/* use direct chmod for local files so that the file doesn't /* use direct chmod for local files so that the file doesn't
* need to be initialized */ * need to be initialized */
if (!src->path)
return 0;
if (stat(src->path, &sb) >= 0) { if (stat(src->path, &sb) >= 0) {
if (sb.st_uid == uid && if (sb.st_uid == uid &&
sb.st_gid == gid) { sb.st_gid == gid) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册