From 719358ae4ca9379a3678856a05ed71332f6fac56 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 11 May 2019 01:56:01 +0900 Subject: [PATCH] kconfig: make parent directories for the saved .config as needed With menuconfig / nconfig, users can input any file path from the "Save" menu, but it fails if the parent directory does not exist. Why not create the parent directory automatically. I think this is a user-friendly behavior. I changed the error messages in menuconfig / nconfig. "Nonexistent directory" is no longer the most likely reason of the failure. Perhaps, the user specified the existing directory, or attempted to write to the location without write permission. Signed-off-by: Masahiro Yamada Signed-off-by: Christian Lamparter --- config/confdata.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/confdata.c b/config/confdata.c index da208c4..52f9282 100644 --- a/config/confdata.c +++ b/config/confdata.c @@ -927,6 +927,9 @@ int conf_write(const char *name) return -1; } + if (make_parent_dir(name)) + return -1; + env = getenv("KCONFIG_OVERWRITECONFIG"); if (env && *env) { *tmpname = 0; -- 2.31.1