[coreboot-gerrit] New patch to review for coreboot: a584357 kconfig: create files in target directory if requested

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Mon Nov 17 14:58:36 CET 2014


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7504

-gerrit

commit a5843578a19a439c2a6cf3dfc59aa3e742443df4
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Mon Nov 17 14:56:49 2014 +0100

    kconfig: create files in target directory if requested
    
    Otherwise rename() fails when used across filesystem
    boundaries.
    
    Change-Id: I22a62310f0e46ac9cfee50b7e9eeed93536ed409
    Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
 util/kconfig/confdata.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/util/kconfig/confdata.c b/util/kconfig/confdata.c
index a611ed7..149e27a 100644
--- a/util/kconfig/confdata.c
+++ b/util/kconfig/confdata.c
@@ -980,14 +980,26 @@ int conf_write_autoconf(void)
 	if (conf_split_config())
 		return 1;
 
-	char *tmpconfig_name = strdup(".tmpconfig.XXXXXX");
+	char *tmpconfig_name = malloc(PATH_MAX);
+	if (getenv("COREBOOT_BUILD_DIR")) {
+		sprintf(tmpconfig_name, "%s/.tmpconfig.XXXXXX",
+			getenv("COREBOOT_BUILD_DIR"));
+	} else {
+		tmpconfig_name = strdup(".tmpconfig.XXXXXX");
+	}
 	if ((i = mkstemp(tmpconfig_name)) == -1)
 		return 1;
 	out = fdopen(i, "w");
 	if (!out)
 		return 1;
 
-	char *tmpconfig_triname = strdup(".tmpconfig_tristate.XXXXXX");
+	char *tmpconfig_triname = malloc(PATH_MAX);
+	if (getenv("COREBOOT_BUILD_DIR")) {
+		sprintf(tmpconfig_triname, "%s/.tmpconfig_tristate.XXXXXX",
+			getenv("COREBOOT_BUILD_DIR"));
+	} else {
+		tmpconfig_triname = strdup(".tmpconfig_tristate.XXXXXX");
+	}
 	if ((i = mkstemp(tmpconfig_triname)) == -1)
 		return 1;
 	tristate = fdopen(i, "w");
@@ -996,7 +1008,13 @@ int conf_write_autoconf(void)
 		return 1;
 	}
 
-	char *tmpconfig_h = strdup(".tmpconfig_tristate.XXXXXX");
+	char *tmpconfig_h = malloc(PATH_MAX);
+	if (getenv("COREBOOT_BUILD_DIR")) {
+		sprintf(tmpconfig_h, "%s/.tmpconfig_tristate.XXXXXX",
+			getenv("COREBOOT_BUILD_DIR"));
+	} else {
+		tmpconfig_h = strdup(".tmpconfig_tristate.XXXXXX");
+	}
 	if ((i = mkstemp(tmpconfig_h)) == -1)
 		return 1;
 	out_h = fdopen(i, "w");



More information about the coreboot-gerrit mailing list