From c1f1ec3514a8871e456f94d510534ce65cc4821f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 24 Oct 2013 23:25:02 +0200 Subject: [PATCH] file: add missing return code check for mktemp() Signed-off-by: Felix Fietkau --- file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/file.c b/file.c index 44b2e02..36bfdda 100644 --- a/file.c +++ b/file.c @@ -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); -- 2.30.2