diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-10-24 23:25:02 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-10-24 23:25:02 +0200 |
commit | c1f1ec3514a8871e456f94d510534ce65cc4821f (patch) | |
tree | 247cb5a1ddf1e8c786ed3b9afebab557633f14e5 | |
parent | 376fdc74c7207292ac9cc71c64f67a66bfd0cbfa (diff) | |
download | uci-c1f1ec3514a8871e456f94d510534ce65cc4821f.tar.gz |
file: add missing return code check for mktemp()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r-- | file.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -702,7 +702,9 @@ static void uci_file_commit(struct uci_context *ctx, struct uci_package **packag if ((asprintf(&filename, "%s/.%s.uci-XXXXXX", ctx->confdir, p->e.name) < 0) || !filename) UCI_THROW(ctx, UCI_ERR_MEM); - mktemp(filename); + if (!mktemp(filename)) + *filename = 0; + if (!*filename) { free(filename); UCI_THROW(ctx, UCI_ERR_IO); |