X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=file.c;h=a58e3924048dd0c96d2bc588d1420824b4fb94a5;hb=c60702b55cf8efe9dcd359fc9aa8e9c7cd421ada;hp=1abe8ff4987d6159affc60c7f847ccb7f84d365c;hpb=cfdea3894f809aada2cf10ba2914aebe8b92316d;p=uci.git diff --git a/file.c b/file.c index 1abe8ff..a58e392 100644 --- a/file.c +++ b/file.c @@ -454,7 +454,8 @@ void uci_file_commit(struct uci_context *ctx, struct uci_package **package, bool } rewind(f); - ftruncate(fileno(f), 0); + if (ftruncate(fileno(f), 0) < 0) + UCI_THROW(ctx, UCI_ERR_IO); uci_export(ctx, f, p, false); UCI_TRAP_RESTORE(ctx);