diff options
author | Martin Willi <martin@strongswan.org> | 2008-11-11 18:37:19 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-11-11 18:37:19 +0000 |
commit | 479f295049956333253310025d3776279e932b46 (patch) | |
tree | e0d6113484a5e191c14a8649f9634cfa15087464 /src/pluto/defs.c | |
parent | 3d2dbebd703fe29c0981f61102094ffe2a4a2101 (diff) | |
download | strongswan-479f295049956333253310025d3776279e932b46.tar.bz2 strongswan-479f295049956333253310025d3776279e932b46.tar.xz |
fixed compiler warnings issued by:
gcc 4.3
curl.h gcc type-checking
glibc with enabled FORTIFY_SOURCE checking
Diffstat (limited to 'src/pluto/defs.c')
-rw-r--r-- | src/pluto/defs.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pluto/defs.c b/src/pluto/defs.c index 5864099d3..c513506f7 100644 --- a/src/pluto/defs.c +++ b/src/pluto/defs.c @@ -249,6 +249,7 @@ write_chunk(const char *filename, const char *label, chunk_t ch { mode_t oldmask; FILE *fd; + size_t written; if (!force) { @@ -268,8 +269,14 @@ write_chunk(const char *filename, const char *label, chunk_t ch if (fd) { - fwrite(ch.ptr, sizeof(u_char), ch.len, fd); + written = fwrite(ch.ptr, sizeof(u_char), ch.len, fd); fclose(fd); + if (written != ch.len) + { + plog(" writing to %s file '%s' failed", label, filename); + umask(oldmask); + return FALSE; + } plog(" written %s file '%s' (%d bytes)", label, filename, (int)ch.len); umask(oldmask); return TRUE; |