From: Alexander Couzens Date: Wed, 19 Mar 2014 12:50:01 +0000 (+0100) Subject: fix `uci import` with not yet existing packages X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=31d4b691d96af442e8dfcefbb7acf85a448bba5c;p=oweals%2Fuci.git fix `uci import` with not yet existing packages uci_file_commit() tries to open and lock a package file (e.g. /etc/config/system) before writing into. When the package file doesn't exist, uci fails with 'Entry not found'. --- diff --git a/file.c b/file.c index 36bfdda..04973f3 100644 --- a/file.c +++ b/file.c @@ -714,7 +714,7 @@ static void uci_file_commit(struct uci_context *ctx, struct uci_package **packag UCI_THROW(ctx, UCI_ERR_IO); /* open the config file for writing now, so that it is locked */ - f1 = uci_open_stream(ctx, p->path, SEEK_SET, false, false); + f1 = uci_open_stream(ctx, p->path, SEEK_SET, true, true); /* flush unsaved changes and reload from delta file */ UCI_TRAP_SAVE(ctx, done);