aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-05-19 14:24:26 +0200
committerMartin Willi <martin@revosec.ch>2011-05-19 15:47:40 +0200
commit513701f41b34bf12fc2ff911ead9a50f2af39826 (patch)
tree4d2fa237335e50ba64a1492a6d46b5e6694f1d18 /src/libstrongswan
parentd30df6ff3d13a0a0dc1d4f6271fbdde314acc6a6 (diff)
downloadstrongswan-513701f41b34bf12fc2ff911ead9a50f2af39826.tar.bz2
strongswan-513701f41b34bf12fc2ff911ead9a50f2af39826.tar.xz
Fix some warnings triggered by gcc 4.6 -Wunused-but-set-variable
Diffstat (limited to 'src/libstrongswan')
-rw-r--r--src/libstrongswan/plugins/af_alg/af_alg_prf.c2
-rw-r--r--src/libstrongswan/plugins/agent/agent_private_key.c4
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c4
-rw-r--r--src/libstrongswan/utils/optionsfrom.c10
4 files changed, 13 insertions, 7 deletions
diff --git a/src/libstrongswan/plugins/af_alg/af_alg_prf.c b/src/libstrongswan/plugins/af_alg/af_alg_prf.c
index 1c1174abb..673ca5e7a 100644
--- a/src/libstrongswan/plugins/af_alg/af_alg_prf.c
+++ b/src/libstrongswan/plugins/af_alg/af_alg_prf.c
@@ -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;
diff --git a/src/libstrongswan/plugins/agent/agent_private_key.c b/src/libstrongswan/plugins/agent/agent_private_key.c
index 0864f4118..dae130bba 100644
--- a/src/libstrongswan/plugins/agent/agent_private_key.c
+++ b/src/libstrongswan/plugins/agent/agent_private_key.c
@@ -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)
{
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
index 38ce2cd6c..feda05bca 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
@@ -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);
diff --git a/src/libstrongswan/utils/optionsfrom.c b/src/libstrongswan/utils/optionsfrom.c
index e51780290..5fd4cfd4d 100644
--- a/src/libstrongswan/utils/optionsfrom.c
+++ b/src/libstrongswan/utils/optionsfrom.c
@@ -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)