[network-manager-openvpn] core: ensure clear error argument during validation (bgo #597593)
- From: Dan Williams <dcbw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn] core: ensure clear error argument during validation (bgo #597593)
- Date: Tue, 6 Oct 2009 23:44:09 +0000 (UTC)
commit b7ad303556d40e66de9ccb43d2a5eadf16f84876
Author: Dan Williams <dcbw redhat com>
Date: Tue Oct 6 16:42:15 2009 -0700
core: ensure clear error argument during validation (bgo #597593)
src/nm-openvpn-service.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 4b45b32..857d539 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -213,7 +213,8 @@ validate_one_property (const char *key, const char *value, gpointer user_data)
static gboolean
nm_openvpn_properties_validate (NMSettingVPN *s_vpn, GError **error)
{
- ValidateInfo info = { &valid_properties[0], error, FALSE };
+ GError *validate_error = NULL;
+ ValidateInfo info = { &valid_properties[0], &validate_error, FALSE };
nm_setting_vpn_foreach_data_item (s_vpn, validate_one_property, &info);
if (!info.have_items) {
@@ -225,13 +226,18 @@ nm_openvpn_properties_validate (NMSettingVPN *s_vpn, GError **error)
return FALSE;
}
- return *error ? FALSE : TRUE;
+ if (validate_error) {
+ *error = validate_error;
+ return FALSE;
+ }
+ return TRUE;
}
static gboolean
nm_openvpn_secrets_validate (NMSettingVPN *s_vpn, GError **error)
{
- ValidateInfo info = { &valid_secrets[0], error, FALSE };
+ GError *validate_error = NULL;
+ ValidateInfo info = { &valid_secrets[0], &validate_error, FALSE };
nm_setting_vpn_foreach_secret (s_vpn, validate_one_property, &info);
if (!info.have_items) {
@@ -243,7 +249,11 @@ nm_openvpn_secrets_validate (NMSettingVPN *s_vpn, GError **error)
return FALSE;
}
- return *error ? FALSE : TRUE;
+ if (validate_error) {
+ *error = validate_error;
+ return FALSE;
+ }
+ return TRUE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]