split-messages: Handle gzprintf failing

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2020-10-03 14:20:07 +01:00
parent 926e560716
commit 2b2469df7e
No known key found for this signature in database
GPG Key ID: C30DF439F2987D74

View File

@ -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;
}