]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
remote: remove unneeded cleanup labels
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 21 Oct 2019 18:18:54 +0000 (15:18 -0300)
committerJán Tomko <jtomko@redhat.com>
Tue, 12 Nov 2019 16:54:01 +0000 (17:54 +0100)
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/remote/remote_daemon.c
src/remote/remote_driver.c

index 56e1455a1a7f855c176f09e2d9eddc045db8d7eb..b400b1dd105932012d5680e24dba7308229fbadb 100644 (file)
@@ -393,7 +393,6 @@ daemonSetupNetworking(virNetServerPtr srv,
     int unix_sock_ro_mask = 0;
     int unix_sock_rw_mask = 0;
     int unix_sock_adm_mask = 0;
-    int ret = -1;
     g_autoptr(virSystemdActivation) act = NULL;
     virSystemdActivationMap actmap[] = {
         { .name = DAEMON_NAME ".socket", .family = AF_UNIX, .path = sock_path },
@@ -447,22 +446,22 @@ daemonSetupNetworking(virNetServerPtr srv,
 
     if (config->unix_sock_group) {
         if (virGetGroupID(config->unix_sock_group, &unix_sock_gid) < 0)
-            return ret;
+            return -1;
     }
 
     if (virStrToLong_i(config->unix_sock_ro_perms, NULL, 8, &unix_sock_ro_mask) != 0) {
         VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_ro_perms);
-        goto cleanup;
+        return -1;
     }
 
     if (virStrToLong_i(config->unix_sock_admin_perms, NULL, 8, &unix_sock_adm_mask) != 0) {
         VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_admin_perms);
-        goto cleanup;
+        return -1;
     }
 
     if (virStrToLong_i(config->unix_sock_rw_perms, NULL, 8, &unix_sock_rw_mask) != 0) {
         VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_rw_perms);
-        goto cleanup;
+        return -1;
     }
 
     if (virNetServerAddServiceUNIX(srv,
@@ -476,7 +475,7 @@ daemonSetupNetworking(virNetServerPtr srv,
                                    false,
                                    config->max_queued_clients,
                                    config->max_client_requests) < 0)
-        goto cleanup;
+        return -1;
     if (sock_path_ro &&
         virNetServerAddServiceUNIX(srv,
                                    act,
@@ -489,7 +488,7 @@ daemonSetupNetworking(virNetServerPtr srv,
                                    true,
                                    config->max_queued_clients,
                                    config->max_client_requests) < 0)
-        goto cleanup;
+        return -1;
 
     if (sock_path_adm &&
         virNetServerAddServiceUNIX(srvAdm,
@@ -503,7 +502,7 @@ daemonSetupNetworking(virNetServerPtr srv,
                                    false,
                                    config->admin_max_queued_clients,
                                    config->admin_max_client_requests) < 0)
-        goto cleanup;
+        return -1;
 
 #ifdef WITH_IP
     if (((ipsock && config->listen_tcp) || act) &&
@@ -518,7 +517,7 @@ daemonSetupNetworking(virNetServerPtr srv,
                                   false,
                                   config->max_queued_clients,
                                   config->max_client_requests) < 0)
-        goto cleanup;
+        return -1;
 
     if (((ipsock && config->listen_tls) || (act && virSystemdActivationHasName(act, DAEMON_NAME "-tls.socket")))) {
         virNetTLSContextPtr ctxt = NULL;
@@ -529,17 +528,17 @@ daemonSetupNetworking(virNetServerPtr srv,
             if (!config->ca_file) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("No CA certificate path set to match server key/cert"));
-                goto cleanup;
+                return -1;
             }
             if (!config->cert_file) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("No server certificate path set to match server key"));
-                goto cleanup;
+                return -1;
             }
             if (!config->key_file) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("No server key path set to match server cert"));
-                goto cleanup;
+                return -1;
             }
             VIR_DEBUG("Using CA='%s' cert='%s' key='%s'",
                       config->ca_file, config->cert_file, config->key_file);
@@ -551,7 +550,7 @@ daemonSetupNetworking(virNetServerPtr srv,
                                                    config->tls_priority,
                                                    config->tls_no_sanity_certificate ? false : true,
                                                    config->tls_no_verify_certificate ? false : true)))
-                goto cleanup;
+                return -1;
         } else {
             if (!(ctxt = virNetTLSContextNewServerPath(NULL,
                                                        !privileged,
@@ -559,7 +558,7 @@ daemonSetupNetworking(virNetServerPtr srv,
                                                        config->tls_priority,
                                                        config->tls_no_sanity_certificate ? false : true,
                                                        config->tls_no_verify_certificate ? false : true)))
-                goto cleanup;
+                return -1;
         }
 
         VIR_DEBUG("Registering TLS socket %s:%s",
@@ -576,7 +575,7 @@ daemonSetupNetworking(virNetServerPtr srv,
                                       config->max_queued_clients,
                                       config->max_client_requests) < 0) {
             virObjectUnref(ctxt);
-            goto cleanup;
+            return -1;
         }
         virObjectUnref(ctxt);
     }
@@ -584,19 +583,16 @@ daemonSetupNetworking(virNetServerPtr srv,
 
     if (act &&
         virSystemdActivationComplete(act) < 0)
-        goto cleanup;
+        return -1;
 
 #if WITH_SASL
     if (virNetServerNeedsAuth(srv, REMOTE_AUTH_SASL) &&
         !(saslCtxt = virNetSASLContextNewServer(
               (const char *const*)config->sasl_allowed_username_list)))
-        goto cleanup;
+        return -1;
 #endif
 
-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }
 
 
index 2872b67469f29e7ac38fba40cd6a5ff5a1fdf214..451a45f5907fd359b0c1dcb6220867750f9c3c8d 100644 (file)
@@ -4176,20 +4176,18 @@ static int remoteAuthInteract(virConnectPtr conn,
                               struct remoteAuthInteractState *state,
                               virConnectAuthPtr auth)
 {
-    int ret = -1;
-
     VIR_DEBUG("Starting SASL interaction");
     remoteAuthInteractStateClear(state, false);
 
     /* Fills state->interact with any values from the auth config file */
     if (remoteAuthFillFromConfig(conn, state) < 0)
-        goto cleanup;
+        return -1;
 
     /* Populates state->cred for anything not found in the auth config */
     if (remoteAuthMakeCredentials(state->interact, &state->cred, &state->ncred) < 0) {
         virReportError(VIR_ERR_AUTH_FAILED, "%s",
                        _("Failed to make auth credentials"));
-        goto cleanup;
+        return -1;
     }
 
     /* If there was anything not in the auth config, we need to
@@ -4200,13 +4198,13 @@ static int remoteAuthInteract(virConnectPtr conn,
         if (!auth || !auth->cb) {
             virReportError(VIR_ERR_AUTH_FAILED, "%s",
                            _("No authentication callback available"));
-            goto cleanup;
+            return -1;
         }
 
         if ((*(auth->cb))(state->cred, state->ncred, auth->cbdata) < 0) {
             virReportError(VIR_ERR_AUTH_FAILED, "%s",
                            _("Failed to collect auth credentials"));
-            goto cleanup;
+            return -1;
         }
 
         /* Copy user's responses from cred into interact */
@@ -4221,10 +4219,7 @@ static int remoteAuthInteract(virConnectPtr conn,
      * of this method, rather than the end.
      */
 
-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }