* [gentoo-commits] gentoo-x86 commit in net-misc/networkmanager/files: networkmanager-0.9.4.0-fix-quote-handling.patch
@ 2012-04-05 3:09 Mu Qiao (qiaomuf)
0 siblings, 0 replies; only message in thread
From: Mu Qiao (qiaomuf) @ 2012-04-05 3:09 UTC (permalink / raw
To: gentoo-commits
qiaomuf 12/04/05 03:09:09
Added: networkmanager-0.9.4.0-fix-quote-handling.patch
Log:
Fix quote handling for global data
(Portage version: 2.1.10.52/cvs/Linux x86_64)
Revision Changes Path
1.1 net-misc/networkmanager/files/networkmanager-0.9.4.0-fix-quote-handling.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.9.4.0-fix-quote-handling.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.9.4.0-fix-quote-handling.patch?rev=1.1&content-type=text/plain
Index: networkmanager-0.9.4.0-fix-quote-handling.patch
===================================================================
From 593f87514484aa82c9f1b39c96ee859671186831 Mon Sep 17 00:00:00 2001
From: Mu Qiao <qiaomuf@gentoo.org>
Date: Thu, 5 Apr 2012 10:12:37 +0800
Subject: [PATCH] ifnet: fix quote handling for global data
---
src/settings/plugins/ifnet/net_parser.c | 13 +++++++------
src/settings/plugins/ifnet/tests/net | 2 ++
src/settings/plugins/ifnet/tests/test_all.c | 3 +++
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c
index 38765f5..c230138 100644
--- a/src/settings/plugins/ifnet/net_parser.c
+++ b/src/settings/plugins/ifnet/net_parser.c
@@ -143,12 +143,13 @@ init_block_by_line (gchar * buf)
pos = g_strrstr (key_value[0], "_");
if (pos == NULL || is_global_setting (key_value[0])) {
/* global data */
- PLUGIN_PRINT (IFNET_PLUGIN_NAME, "global:%s-%s\n", key_value[0],
- key_value[1]);
- g_hash_table_insert (global_settings_table,
- g_strdup (key_value[0]),
- g_strdup (key_value[1]));
+ data = g_strdup (key_value[1]);
+ tmp = strip_string (data, '"');
+ strip_string (tmp, '\'');
+ PLUGIN_PRINT (IFNET_PLUGIN_NAME, "global:%s-%s\n", key_value[0], tmp);
+ g_hash_table_insert (global_settings_table, g_strdup (key_value[0]), g_strdup (tmp));
g_strfreev (key_value);
+ g_free (data);
return;
}
*pos++ = '\0';
@@ -593,7 +594,7 @@ ifnet_flush_to_file (const char *config_file)
/* Writing global data */
while (g_hash_table_iter_next (&iter, &key, &value)) {
out_line =
- g_strdup_printf ("%s=%s\n", (gchar *) key, (gchar *) value);
+ g_strdup_printf ("%s=\"%s\"\n", (gchar *) key, (gchar *) value);
g_io_channel_write_chars (channel, out_line, -1,
&bytes_written, error);
if (bytes_written == 0 || (error && *error))
diff --git a/src/settings/plugins/ifnet/tests/net b/src/settings/plugins/ifnet/tests/net
index 27d39f4..a5ac9ca 100644
--- a/src/settings/plugins/ifnet/tests/net
+++ b/src/settings/plugins/ifnet/tests/net
@@ -3,6 +3,8 @@
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
+modules="!wpa_supplicant"
+
config_eth0=(
"202.117.16.121 netmask 255.255.255.0 brd 202.117.16.255"
"192.168.4.121/24"
diff --git a/src/settings/plugins/ifnet/tests/test_all.c b/src/settings/plugins/ifnet/tests/test_all.c
index 50441d4..974258b 100644
--- a/src/settings/plugins/ifnet/tests/test_all.c
+++ b/src/settings/plugins/ifnet/tests/test_all.c
@@ -56,6 +56,9 @@ test_getdata ()
&& strcmp (ifnet_get_data ("ppp0", "password"),
"password") == 0, "get data",
"config_ppp0 password is not correctly read");
+ ASSERT (ifnet_get_global_data ("modules")
+ && strcmp ("!wpa_supplicant", ifnet_get_global_data ("modules")) == 0,
+ "get data", "config_eth1 is not correct");
}
static void
--
1.7.3.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-04-05 3:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-05 3:09 [gentoo-commits] gentoo-x86 commit in net-misc/networkmanager/files: networkmanager-0.9.4.0-fix-quote-handling.patch Mu Qiao (qiaomuf)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox