summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-05-11 23:45:42 +0100
committerVincent Sanders <vince@kyllikki.org>2014-05-11 23:45:42 +0100
commitc3e2dc90057cc531a19aafcf65c5916dabceb2ef (patch)
tree88a187565b819ea74a3991d1a338e91a1442ae20 /utils
parent83fa2a9482a263f59e6f0b4d9181e2f1629bc876 (diff)
downloadnetsurf-c3e2dc90057cc531a19aafcf65c5916dabceb2ef.tar.gz
netsurf-c3e2dc90057cc531a19aafcf65c5916dabceb2ef.tar.bz2
check return values of fseek (fixes coverity 1109840)
Diffstat (limited to 'utils')
-rw-r--r--utils/container.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/utils/container.c b/utils/container.c
index 3e03e15f1..9ffe7f5c0 100644
--- a/utils/container.c
+++ b/utils/container.c
@@ -382,15 +382,17 @@ void container_close(struct container_ctx *ctx)
flen = (flen + 3) & (~3); /* round up to nearest 4 bytes */
/* write this location to the header */
- fseek(ctx->fh, 104, SEEK_SET);
- nflen = htonl(flen);
- val = fwrite(&nflen, 4, 1, ctx->fh);
- if (val == 0)
- LOG(("empty write directory location"));
+ if (fseek(ctx->fh, 104, SEEK_SET) == 0) {
+ nflen = htonl(flen);
+ val = fwrite(&nflen, 4, 1, ctx->fh);
+ if (val == 0)
+ LOG(("empty write directory location"));
- /* seek to where the directory will be, and write it */
- fseek(ctx->fh, flen, SEEK_SET);
- container_write_dir(ctx);
+ /* seek to where the directory will be, and write it */
+ if (fseek(ctx->fh, flen, SEEK_SET) == 0) {
+ container_write_dir(ctx);
+ }
+ }
} else if (ctx->processed) {
#ifdef WITH_MMAP