[rygel/wip/basic-management: 131/138] core: BasicManagement: let GLib.Spawn handle building the command



commit 4d9cc8480f2febcb740e8ee1e278ebdb17b25e5f
Author: Jussi Kukkonen <jussi kukkonen intel com>
Date:   Sun Jun 16 12:57:30 2013 +0300

    core: BasicManagement: let GLib.Spawn handle building the command
    
    Some commands are very picky about the command line options:
    giving GLib.Spawn every parameter separately is safest.

 .../rygel-basic-management-test-nslookup.vala      |    6 +++---
 .../rygel-basic-management-test-ping.vala          |   14 +++++++-------
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/librygel-core/rygel-basic-management-test-nslookup.vala 
b/src/librygel-core/rygel-basic-management-test-nslookup.vala
index 53e07fc..6a73575 100644
--- a/src/librygel-core/rygel-basic-management-test-nslookup.vala
+++ b/src/librygel-core/rygel-basic-management-test-nslookup.vala
@@ -204,9 +204,9 @@ internal class Rygel.BasicManagementTestNSLookup : BasicManagementTest {
         this.additional_info = "";
         this.results = {};
 
-        this.command = { "nslookup" };
-        this.command += ("-timeout=%u").printf (this.interval_time_out/1000);
-        this.command += host_name;
+        this.command = { "nslookup",
+                         "-timeout=%u".printf (this.interval_time_out/1000),
+                         host_name };
         if (name_server != null && name_server.length > 0)
             this.command += name_server;
 
diff --git a/src/librygel-core/rygel-basic-management-test-ping.vala 
b/src/librygel-core/rygel-basic-management-test-ping.vala
index a49c1ae..72ed796 100644
--- a/src/librygel-core/rygel-basic-management-test-ping.vala
+++ b/src/librygel-core/rygel-basic-management-test-ping.vala
@@ -148,13 +148,13 @@ internal class Rygel.BasicManagementTestPing : BasicManagementTest {
         this.min_response_time = 0;
         this.max_response_time = 0;
 
-        this.command = { "ping" };
-        this.command += ("-c %u").printf (repeat_count);
-        this.command += ("-W %u").printf (DEFAULT_REPLY_TIMEOUT/1000);
-        this.command += ("-i %u").printf (interval_time_out/1000);
-        this.command += ("-s %u").printf (data_block_size);
-        this.command += ("-Q %u").printf (dscp >> 2);
-        this.command += host;
+        this.command = { "ping",
+                         "-c", this.repeat_count.to_string (),
+                         "-W", (DEFAULT_REPLY_TIMEOUT / 1000).to_string (),
+                         "-i", (this.interval_time_out / 1000).to_string (),
+                         "-s", this.data_block_size.to_string (),
+                         "-Q", (this.dscp >> 2).to_string (),
+                         this.host };
 
         if (this.repeat_count > MAX_REPEAT_COUNT) {
             this.init_state = InitState.INVALID_PARAMETER;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]