From 7f1c76f2bfdffa549c2fe026743e0e1e6e635262 Mon Sep 17 00:00:00 2001 From: Juan Manuel Cruz Date: Tue, 15 Nov 2016 15:35:07 -0600 Subject: win-build: Fixes a kconfig incompatibility for Windows In windows systems the rename() function fails if the new name of the original file corresponds to a file that already exists. The fix removes the new file before renaming the original one. Jira: ZEP-980 Change-Id: Ib3a43db86c0dd3fabb592f53ea7619eb5738bb65 Signed-off-by: Juan Manuel Cruz --- scripts/kconfig/confdata.c | 5 +++++ scripts/kconfig/util.c | 1 + 2 files changed, 6 insertions(+) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index d21fe0938..02ee6e9e9 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -824,7 +824,9 @@ next: if (*tmpname) { strcat(dirname, basename); strcat(dirname, ".old"); + remove(dirname); rename(newname, dirname); + remove(newname); if (rename(tmpname, newname)) return 1; } @@ -1004,11 +1006,13 @@ int conf_write_autoconf(void) name = getenv("KCONFIG_AUTOHEADER"); if (!name) name = "include/generated/autoconf.h"; + remove(name); if (rename(".tmpconfig.h", name)) return 1; name = getenv("KCONFIG_TRISTATE"); if (!name) name = "include/config/tristate.conf"; + remove(name); if (rename(".tmpconfig_tristate", name)) return 1; name = conf_get_autoconfig_name(); @@ -1016,6 +1020,7 @@ int conf_write_autoconf(void) * This must be the last step, kbuild has a dependency on auto.conf * and this marks the successful completion of the previous steps. */ + remove(name); if (rename(".tmpconfig", name)) return 1; diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 94f9c83e3..65f7052fb 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c @@ -72,6 +72,7 @@ int file_write_dep(const char *name) fprintf(out, "\n$(deps_config): ;\n"); fclose(out); + remove(name); rename("..config.tmp", name); return 0; } -- cgit v1.2.3