summaryrefslogtreecommitdiff
path: root/src/pluto/defs.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2008-12-05 16:15:54 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2008-12-05 16:15:54 +0000
commitc7f1b0530b85bc7654e68992f25ed8ced5d0a80d (patch)
tree861798cd7da646014ed6919766b053099646710d /src/pluto/defs.c
parent8b80ab5a6950ce6515f477624794defd7531642a (diff)
downloadvyos-strongswan-c7f1b0530b85bc7654e68992f25ed8ced5d0a80d.tar.gz
vyos-strongswan-c7f1b0530b85bc7654e68992f25ed8ced5d0a80d.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.2.9)
Diffstat (limited to 'src/pluto/defs.c')
-rw-r--r--src/pluto/defs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/pluto/defs.c b/src/pluto/defs.c
index 5b9defb60..f2c1eab48 100644
--- a/src/pluto/defs.c
+++ b/src/pluto/defs.c
@@ -11,7 +11,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * RCSID $Id: defs.c 3252 2007-10-06 21:24:50Z andreas $
+ * RCSID $Id: defs.c 4632 2008-11-11 18:37:19Z martin $
*/
#include <stdlib.h>
@@ -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;