[network-manager-applet] c-e: minor code cleanup in eap_method_validate_filepicker()



commit 0f1329aabe53edf50c33498c66839a04effa9383
Author: Thomas Haller <thaller redhat com>
Date:   Thu Mar 23 12:42:06 2017 +0100

    c-e: minor code cleanup in eap_method_validate_filepicker()
    
    The check for empty password is redundant. Drop it.

 src/wireless-security/eap-method.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/wireless-security/eap-method.c b/src/wireless-security/eap-method.c
index 46628d3..c2da74b 100644
--- a/src/wireless-security/eap-method.c
+++ b/src/wireless-security/eap-method.c
@@ -214,14 +214,9 @@ eap_method_validate_filepicker (GtkBuilder *builder,
                                 GError **error)
 {
        GtkWidget *widget;
-       char *filename;
+       gs_free char *filename = NULL;
        NMSetting8021x *setting;
-       gboolean success = TRUE;
-
-       if (item_type == TYPE_PRIVATE_KEY) {
-               if (!password || *password == '\0')
-                       success = FALSE;
-       }
+       gboolean success;
 
        widget = GTK_WIDGET (gtk_builder_get_object (builder, name));
        g_assert (widget);
@@ -230,7 +225,8 @@ eap_method_validate_filepicker (GtkBuilder *builder,
                if (item_type != TYPE_CA_CERT) {
                        success = FALSE;
                        g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("no file selected"));
-               }
+               } else
+                       success = TRUE;
                goto out;
        }
 
@@ -258,8 +254,6 @@ eap_method_validate_filepicker (GtkBuilder *builder,
        g_object_unref (setting);
 
 out:
-       g_free (filename);
-
        if (!success && error && !*error)
                g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("unspecified error validating 
eap-method file"));
 


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