From 2b2469df7ef088d219a8bc911769ffde149c1129 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 3 Oct 2020 14:20:07 +0100 Subject: split-messages: Handle gzprintf failing Signed-off-by: Daniel Silverstone --- tools/split-messages.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/split-messages.c b/tools/split-messages.c index 0bce7397f..73a95e153 100644 --- a/tools/split-messages.c +++ b/tools/split-messages.c @@ -500,13 +500,21 @@ message_write(struct param *param, struct trnsltn_entry *tlist) return NSERROR_PERMISSION; } - gzprintf(outf, + if (gzprintf(outf, "# This messages file is automatically generated from %s\n" "# at build-time. Please go and edit that instead of this.\n\n", - param->infilename); + param->infilename) < 1) { + gzclose(outf); + unlink(param->outfilename); + return NSERROR_NOSPACE; + }; while (tlist != NULL) { - gzprintf(outf, "%s:%s\n", tlist->key, tlist->value); + if (gzprintf(outf, "%s:%s\n", tlist->key, tlist->value) < 1) { + gzclose(outf); + unlink(param->outfilename); + return NSERROR_NOSPACE; + } tlist = tlist->next; } -- cgit v1.2.3