From: Vincent Lefevre Date: Wed, 16 Mar 2016 01:01:44 +0000 (-0700) Subject: Check return value of ftruncate() in mbox_sync_mailbox(). X-Git-Tag: neomutt-20160404~55 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bbba3d4ed2752f18c4d33d89a8e8cdf7c3df8737;p=neomutt Check return value of ftruncate() in mbox_sync_mailbox(). Generate an error in the event that ftruncate() fails. --- diff --git a/mbox.c b/mbox.c index cdc810994..870da6aaa 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")); + } } }