[gnome-boxes] libvirt-system-importer: Don't needlessly chmod disk
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] libvirt-system-importer: Don't needlessly chmod disk
- Date: Mon, 2 Feb 2015 20:39:46 +0000 (UTC)
commit 4a3b15299dfffa63a02825d0e1cb4cdfa6302491
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Feb 2 19:38:27 2015 +0000
libvirt-system-importer: Don't needlessly chmod disk
If disk image is already readable, there is no need to launch annoying
policykit dialog.
src/libvirt-system-importer.vala | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/libvirt-system-importer.vala b/src/libvirt-system-importer.vala
index c8cb676..887e2d2 100644
--- a/src/libvirt-system-importer.vala
+++ b/src/libvirt-system-importer.vala
@@ -135,8 +135,21 @@ private class Boxes.LibvirtSystemImporter: GLib.Object {
argv += "pkexec";
argv += "chmod";
argv += "a+r";
- foreach (var disk_path in disk_paths)
- argv += disk_path;
+
+ foreach (var disk_path in disk_paths) {
+ var file = File.new_for_path (disk_path);
+ var info = yield file.query_info_async (FileAttribute.ACCESS_CAN_READ,
+ FileQueryInfoFlags.NONE,
+ Priority.DEFAULT,
+ null);
+ if (!info.get_attribute_boolean (FileAttribute.ACCESS_CAN_READ)) {
+ debug ("'%s' not readable, gotta make it readable..", disk_path);
+ argv += disk_path;
+ }
+ }
+
+ if (argv.length == 3)
+ return;
debug ("Making all libvirt system disks readable..");
yield exec (argv, null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]