diff options
author | Patrick Georgi <patrick@georgi-clan.de> | 2014-11-17 14:56:49 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2014-11-18 08:25:50 +0100 |
commit | 129462da1b6b5c3b2649c99cc6c75fb275bff21d (patch) | |
tree | 7b735c2117869876d74a66c9a8f2a824c6ff46be /util/kconfig | |
parent | 2dc01324f5b22b507eb7685fab3a49bbf0f5bf25 (diff) |
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@google.com>
Reviewed-on: http://review.coreboot.org/7504
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'util/kconfig')
-rw-r--r-- | util/kconfig/confdata.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/util/kconfig/confdata.c b/util/kconfig/confdata.c index a611ed7b01..149e27aec5 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"); |