aboutsummaryrefslogtreecommitdiffstats
path: root/src/pluto/defs.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-11-11 18:37:19 +0000
committerMartin Willi <martin@strongswan.org>2008-11-11 18:37:19 +0000
commit479f295049956333253310025d3776279e932b46 (patch)
treee0d6113484a5e191c14a8649f9634cfa15087464 /src/pluto/defs.c
parent3d2dbebd703fe29c0981f61102094ffe2a4a2101 (diff)
downloadstrongswan-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.c9
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;