diff options
author | Martin Willi <martin@revosec.ch> | 2013-03-19 13:44:11 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-03-19 13:46:16 +0100 |
commit | 824864f4e02b70d7a37221070b3eda1a953509da (patch) | |
tree | 77b69d9c7f451022df72048c9b8e4e264aec24a8 /src | |
parent | 8a0a1ae8578c000c51f45ebca0fd75f763c6365e (diff) | |
download | strongswan-824864f4e02b70d7a37221070b3eda1a953509da.tar.bz2 strongswan-824864f4e02b70d7a37221070b3eda1a953509da.tar.xz |
Don't try to mmap() empty ipsec.secret files
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/stroke/stroke_cred.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcharon/plugins/stroke/stroke_cred.c b/src/libcharon/plugins/stroke/stroke_cred.c index c401bc6f1..e9da477fa 100644 --- a/src/libcharon/plugins/stroke/stroke_cred.c +++ b/src/libcharon/plugins/stroke/stroke_cred.c @@ -991,6 +991,11 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level, close(fd); return; } + if (sb.st_size == 0) + { /* skip empty files, as mmap() complains */ + close(fd); + return; + } addr = mmap(NULL, sb.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); if (addr == MAP_FAILED) { @@ -1262,4 +1267,3 @@ stroke_cred_t *stroke_cred_create() return &this->public; } - |