diff options
author | Martin Willi <martin@revosec.ch> | 2011-05-19 14:24:26 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2011-05-19 15:47:40 +0200 |
commit | 513701f41b34bf12fc2ff911ead9a50f2af39826 (patch) | |
tree | 4d2fa237335e50ba64a1492a6d46b5e6694f1d18 /src/libstrongswan/utils/optionsfrom.c | |
parent | d30df6ff3d13a0a0dc1d4f6271fbdde314acc6a6 (diff) | |
download | strongswan-513701f41b34bf12fc2ff911ead9a50f2af39826.tar.bz2 strongswan-513701f41b34bf12fc2ff911ead9a50f2af39826.tar.xz |
Fix some warnings triggered by gcc 4.6 -Wunused-but-set-variable
Diffstat (limited to 'src/libstrongswan/utils/optionsfrom.c')
-rw-r--r-- | src/libstrongswan/utils/optionsfrom.c | 10 |
1 files changed, 8 insertions, 2 deletions
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) |