summaryrefslogtreecommitdiffstats
path: root/src/rccxml.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2013-11-13 19:26:15 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2013-11-13 19:26:15 +0100
commit2e1a735c1bb76094744a6112b092331e34c7db09 (patch)
tree7d71a21f6e193d6a67bba0275d01613ca658e20a /src/rccxml.c
parent91522bd0b3cff351252ebbdbd23e1a2a02688394 (diff)
downloadlibrcc-2e1a735c1bb76094744a6112b092331e34c7db09.tar.gz
librcc-2e1a735c1bb76094744a6112b092331e34c7db09.tar.bz2
librcc-2e1a735c1bb76094744a6112b092331e34c7db09.tar.xz
librcc-2e1a735c1bb76094744a6112b092331e34c7db09.zip
Respect warn_unused_result warnings
Diffstat (limited to 'src/rccxml.c')
-rw-r--r--src/rccxml.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/rccxml.c b/src/rccxml.c
index 6fb7e28..39992f2 100644
--- a/src/rccxml.c
+++ b/src/rccxml.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <stdarg.h>
+#include <errno.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
@@ -455,10 +456,18 @@ int rccSave(rcc_context ctx, const char *name) {
}
xmlDocDumpFormatMemory(doc,&mem,&memsize,1);
- ftruncate(fd, 0);
- lseek(fd, SEEK_SET, 0);
+
+ if (ftruncate(fd, 0) < 0)
+ goto clear;
+
+ if (lseek(fd, SEEK_SET, 0))
+ goto clear;
+
if (mem) {
- write(fd, mem, memsize);
+ ssize_t ret = write(fd, mem, memsize);
+ // Retry once on signals
+ if ((ret < 0)&&(errno = EINTR))
+ ret = write(fd, mem, memsize);
free(mem);
}