[PATCH] kconfig: allow KCONFIG_CONFIG environment to be full path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When no name arg is passed to conf_write, the .tmpconfig file used to
prepare a new config is created in the working dir. If KCONFIG_CONFIG
specifies a path which is not on the same volume, the rename fails
with 'Invalid cross-device link'.

This change determines the dir passed in KCONFIG_CONFIG, and uses it
as the location for the tmpconfig.

Signed-off-by: Andy Voltz <andy.voltz@xxxxxxxxxxx>
---
 scripts/kconfig/confdata.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index f88d90f..072838b 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -743,26 +743,26 @@ int conf_write(const char *name)
 	char *env;
 
 	dirname[0] = 0;
-	if (name && name[0]) {
-		struct stat st;
-		char *slash;
+	if (!name)
+		name = conf_get_configname();
+
+	struct stat st;
+	char *slash;
 
-		if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
-			strcpy(dirname, name);
-			strcat(dirname, "/");
+	if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
+		strcpy(dirname, name);
+		strcat(dirname, "/");
+		basename = conf_get_configname();
+	} else if ((slash = strrchr(name, '/'))) {
+		int size = slash - name + 1;
+		memcpy(dirname, name, size);
+		dirname[size] = 0;
+		if (slash[1])
+			basename = slash + 1;
+		else
 			basename = conf_get_configname();
-		} else if ((slash = strrchr(name, '/'))) {
-			int size = slash - name + 1;
-			memcpy(dirname, name, size);
-			dirname[size] = 0;
-			if (slash[1])
-				basename = slash + 1;
-			else
-				basename = conf_get_configname();
-		} else
-			basename = name;
 	} else
-		basename = conf_get_configname();
+		basename = name;
 
 	sprintf(newname, "%s%s", dirname, basename);
 	env = getenv("KCONFIG_OVERWRITECONFIG");
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux