X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=file.c;h=a58e3924048dd0c96d2bc588d1420824b4fb94a5;hp=06ba34df95dc4379e0d23974cc5f6222fd6c5701;hb=b6b935fd51a8db067be564cf445a67c4c78df68f;hpb=1a388b01f8c85a8a8b987789096d1f9e86b29fdf diff --git a/file.c b/file.c index 06ba34d..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); @@ -528,6 +529,7 @@ static char **uci_list_config_files(struct uci_context *ctx) buf += strlen(buf) + 1; } free(dir); + globfree(&globbuf); return configs; }