Browse Source

file: add missing return code check for mktemp()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau 10 years ago
parent
commit
c1f1ec3514
1 changed files with 3 additions and 1 deletions
  1. 3 1
      file.c

+ 3 - 1
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);