summaryrefslogtreecommitdiffstats
path: root/mbox.c
diff options
context:
space:
mode:
authorVincent Lefevre <vincent@vinc17.net>2016-03-15 18:01:44 -0700
committerVincent Lefevre <vincent@vinc17.net>2016-03-15 18:01:44 -0700
commit79993d7f8e866904bb28ed4365eb419057fc43a7 (patch)
tree8cffd2482060ea07b881d4f36b08e3b4d5868a16 /mbox.c
parent28cb7826a4caf4c2e711ad02d3e2d8b3b78992de (diff)
Check return value of ftruncate() in mbox_sync_mailbox().
Generate an error in the event that ftruncate() fails.
Diffstat (limited to 'mbox.c')
-rw-r--r--mbox.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mbox.c b/mbox.c
index cdc81099..870da6aa 100644
--- a/mbox.c
+++ b/mbox.c
@@ -968,7 +968,11 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if (i == 0)
{
ctx->size = ftello (ctx->fp); /* update the size of the mailbox */
- ftruncate (fileno (ctx->fp), ctx->size);
+ if (ftruncate (fileno (ctx->fp), ctx->size) != 0)
+ {
+ i = -1;
+ dprint (1, (debugfile, "mbox_sync_mailbox: ftruncate() failed\n"));
+ }
}
}