Fix some warnings triggered by gcc 4.6 -Wunused-but-set-variable
authorMartin Willi <martin@revosec.ch>
Thu, 19 May 2011 12:24:26 +0000 (14:24 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 19 May 2011 13:47:40 +0000 (15:47 +0200)
12 files changed:
scripts/bin2sql.c
src/libcharon/daemon.c
src/libcharon/encoding/payloads/sa_payload.c
src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
src/libcharon/plugins/nm/nm_service.c
src/libcharon/plugins/socket_raw/socket_raw_socket.c
src/libstrongswan/plugins/af_alg/af_alg_prf.c
src/libstrongswan/plugins/agent/agent_private_key.c
src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
src/libstrongswan/utils/optionsfrom.c
src/scepclient/scepclient.c
src/starter/starter.c

index 8bc72f8..ce5e600 100644 (file)
@@ -6,7 +6,6 @@
  */
 int main(int argc, char *argv[])
 {
-       int end = 0;
        unsigned char byte;
 
        printf("X'");
@@ -14,7 +13,6 @@ int main(int argc, char *argv[])
        {
                if (fread(&byte, 1, 1, stdin) != 1)
                {
-                       end = 1;
                        break;
                }
                printf("%02x", (unsigned int)byte);
index 796e455..6aa771e 100644 (file)
@@ -322,9 +322,7 @@ void libcharon_deinit()
  */
 bool libcharon_init()
 {
-       private_daemon_t *this;
-
-       this = daemon_create();
+       daemon_create();
 
        /* for uncritical pseudo random numbers */
        srandom(time(NULL) + getpid());
index db20d05..89464ac 100644 (file)
@@ -106,7 +106,6 @@ METHOD(payload_t, verify, status_t,
        status_t status = SUCCESS;
        enumerator_t *enumerator;
        proposal_substructure_t *substruct;
-       bool first = TRUE;
 
        /* check proposal numbering */
        enumerator = this->proposals->create_enumerator(this->proposals);
@@ -136,7 +135,6 @@ METHOD(payload_t, verify, status_t,
                        DBG1(DBG_ENC, "PROPOSAL_SUBSTRUCTURE verification failed");
                        break;
                }
-               first = FALSE;
                expected_number = current_number;
        }
        enumerator->destroy(enumerator);
index 1dd94f6..9dfc692 100644 (file)
@@ -814,7 +814,7 @@ static status_t process_peer_failure(private_eap_mschapv2_t *this,
        eap_mschapv2_header_t *eap;
        chunk_t data;
        char *message, *token, *msg = NULL;
-       int message_len, error = 0, retriable;
+       int message_len, error = 0;
        chunk_t challenge = chunk_empty;
 
        data = in->get_data(in);
@@ -842,8 +842,7 @@ static status_t process_peer_failure(private_eap_mschapv2_t *this,
                }
                else if (strneq(token, "R=", 2))
                {
-                       token += 2;
-                       retriable = atoi(token);
+                       /* ignore retriable */
                }
                else if (strneq(token, "C=", 2))
                {
@@ -860,9 +859,7 @@ static status_t process_peer_failure(private_eap_mschapv2_t *this,
                }
                else if (strneq(token, "V=", 2))
                {
-                       int version;
-                       token += 2;
-                       version = atoi(token);
+                       /* ignore version */
                }
                else if (strneq(token, "M=", 2))
                {
index 236a7e5..65218d0 100644 (file)
@@ -82,12 +82,11 @@ static void signal_ipv4_config(NMVPNPlugin *plugin,
 {
        GValue *val;
        GHashTable *config;
-       host_t *me, *other;
+       host_t *me;
        nm_handler_t *handler;
 
        config = g_hash_table_new(g_str_hash, g_str_equal);
        me = ike_sa->get_my_host(ike_sa);
-       other = ike_sa->get_other_host(ike_sa);
        handler = NM_STRONGSWAN_PLUGIN_GET_PRIVATE(plugin)->handler;
 
        /* NM requires a tundev, but netkey does not use one. Passing an invalid
index f6e87a8..242d098 100644 (file)
@@ -435,7 +435,6 @@ static int open_send_socket(private_socket_raw_socket_t *this,
        int on = TRUE;
        int type = UDP_ENCAP_ESPINUDP;
        struct sockaddr_storage addr;
-       u_int sol;
        int skt;
 
        memset(&addr, 0, sizeof(addr));
@@ -448,7 +447,6 @@ static int open_send_socket(private_socket_raw_socket_t *this,
                        sin->sin_family = AF_INET;
                        sin->sin_addr.s_addr = INADDR_ANY;
                        sin->sin_port = htons(port);
-                       sol = SOL_IP;
                        break;
                }
                case AF_INET6:
@@ -457,7 +455,6 @@ static int open_send_socket(private_socket_raw_socket_t *this,
                        sin6->sin6_family = AF_INET6;
                        memcpy(&sin6->sin6_addr, &in6addr_any, sizeof(in6addr_any));
                        sin6->sin6_port = htons(port);
-                       sol = SOL_IPV6;
                        break;
                }
                default:
@@ -514,18 +511,16 @@ static int open_recv_socket(private_socket_raw_socket_t *this, int family)
 {
        int skt;
        int on = TRUE;
-       u_int proto_offset, ip_len, sol, udp_header, ike_header;
+       u_int ip_len, sol, udp_header, ike_header;
 
        /* precalculate constants depending on address family */
        switch (family)
        {
                case AF_INET:
-                       proto_offset = IP_PROTO_OFFSET;
                        ip_len = IP_LEN;
                        sol = SOL_IP;
                        break;
                case AF_INET6:
-                       proto_offset = IP6_PROTO_OFFSET;
                        ip_len = 0; /* IPv6 raw sockets contain no IP header */
                        sol = SOL_IPV6;
                        break;
index 1c1174a..673ca5e 100644 (file)
@@ -90,7 +90,7 @@ void af_alg_prf_probe(char *plugin)
 /**
  * Get the kernel algorithm string and block size for our identifier
  */
-static size_t lookup_alg(integrity_algorithm_t algo, char **name, bool *xcbc)
+static size_t lookup_alg(pseudo_random_function_t algo, char **name, bool *xcbc)
 {
        int i;
 
index 0864f41..dae130b 100644 (file)
@@ -161,7 +161,7 @@ static int open_connection(char *path)
  */
 static bool read_key(private_agent_private_key_t *this, public_key_t *pubkey)
 {
-       int len, count;
+       int len;
        char buf[2048];
        chunk_t blob, key, type, n;
 
@@ -184,7 +184,7 @@ static bool read_key(private_agent_private_key_t *this, public_key_t *pubkey)
                DBG1(DBG_LIB, "received invalid ssh-agent identity response");
                return FALSE;
        }
-       count = read_uint32(&blob);
+       read_uint32(&blob);
 
        while (blob.len)
        {
index 38ce2cd..feda05b 100644 (file)
@@ -504,7 +504,7 @@ gcrypt_rsa_private_key_t *gcrypt_rsa_private_key_load(key_type_t type,
                                                                                                          va_list args)
 {
        private_gcrypt_rsa_private_key_t *this;
-       chunk_t n, e, d, p, q, exp, u;
+       chunk_t n, e, d, p, q, u;
        gcry_error_t err;
 
        n = e = d = p = q = u = chunk_empty;
@@ -531,7 +531,7 @@ gcrypt_rsa_private_key_t *gcrypt_rsa_private_key_load(key_type_t type,
                        case BUILD_RSA_EXP1:
                        case BUILD_RSA_EXP2:
                                /* not required for gcrypt */
-                               exp = va_arg(args, chunk_t);
+                               va_arg(args, chunk_t);
                                continue;
                        case BUILD_RSA_COEFF:
                                u = va_arg(args, chunk_t);
index e517802..5fd4cfd 100644 (file)
@@ -67,7 +67,6 @@ METHOD(options_t, from, bool,
        int newargc;
        int next;                       /* place for next argument */
        char **newargv;
-       size_t bytes;
        chunk_t src, line, token;
        bool good = TRUE;
        int linepos = 0;
@@ -99,7 +98,14 @@ METHOD(options_t, from, bool,
        src.ptr = this->buffers[this->nuses] = malloc(src.len + 1);
 
        /* read the whole file into a chunk */
-       bytes = fread(src.ptr, 1, src.len, fd);
+       if (fread(src.ptr, 1, src.len, fd) != src.len)
+       {
+               DBG1(DBG_LIB, "optionsfrom: unable to read file '%s': %s",
+                        filename, strerror(errno));
+               free(src.ptr);
+               fclose(fd);
+               return FALSE;
+       }
        fclose(fd);
 
        if (this->room)
index d9f6b09..e91b3f5 100644 (file)
@@ -333,7 +333,6 @@ int main(int argc, char **argv)
        char *file_out_pkcs7     = DEFAULT_FILENAME_PKCS7;
        char *file_out_cert_self = DEFAULT_FILENAME_CERT_SELF;
        char *file_out_cert      = DEFAULT_FILENAME_CERT;
-       char *file_out_prefix_cacert = DEFAULT_FILENAME_PREFIX_CACERT;
 
        /* by default user certificate is requested */
        bool request_ca_certificate = FALSE;
@@ -540,8 +539,6 @@ int main(int argc, char **argv)
                                else if (strcaseeq("cacert", optarg))
                                {
                                        request_ca_certificate = TRUE;
-                                       if (filename)
-                                               file_out_prefix_cacert = filename;
                                }
                                else
                                {
index fcef2f7..d86da21 100644 (file)
@@ -233,7 +233,6 @@ int main (int argc, char **argv)
 
        struct stat stb;
 
-       char *err = NULL;
        int i;
        int id = 1;
        struct timeval tv;
@@ -495,7 +494,6 @@ int main (int argc, char **argv)
                 */
                if (_action_ & FLAG_ACTION_UPDATE)
                {
-                       err = NULL;
                        DBG(DBG_CONTROL,
                                DBG_log("Reloading config...")
                           );