]> pilppa.org Git - uci.git/blobdiff - file.c
rename ucimap_data::section to ptr
[uci.git] / file.c
diff --git a/file.c b/file.c
index 06ba34df95dc4379e0d23974cc5f6222fd6c5701..a58e3924048dd0c96d2bc588d1420824b4fb94a5 100644 (file)
--- 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;
 }