summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2021-10-01 07:32:52 +0200
committerMasahiro Yamada <masahiroy@kernel.org>2021-10-11 16:13:23 +0200
commitfee762d69ad5968dfd0ecbc300810f185ee5c5b8 (patch)
treeb34e3bd9e7edcb8e45d2d4b43b74bd53f35e07aa /scripts/kconfig/confdata.c
parentkconfig: refactor conf_write_dep() (diff)
downloadlinux-fee762d69ad5968dfd0ecbc300810f185ee5c5b8.tar.xz
linux-fee762d69ad5968dfd0ecbc300810f185ee5c5b8.zip
kconfig: refactor conf_touch_dep()
If this function fails to touch a dummy header due to missing parent directory, then it creates it and touches the file again. This was needed because CONFIG_FOO_BAR was previously tracked by include/config/foo/bar.h. (include/config/foo/ may not exist here) This is no longer the case since commit 0e0345b77ac4 ("kbuild: redo fake deps at include/config/*.h"); now all the fake headers are placed right under include/config/, like include/config/FOO_BAR. Do not try to create parent directory, include/config/, which already exists. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to '')
-rw-r--r--scripts/kconfig/confdata.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 6ac53bf7aa64..42bc56ee238c 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -130,31 +130,17 @@ static size_t depfile_prefix_len;
/* touch depfile for symbol 'name' */
static int conf_touch_dep(const char *name)
{
- int fd, ret;
- char *d;
+ int fd;
/* check overflow: prefix + name + '\0' must fit in buffer. */
if (depfile_prefix_len + strlen(name) + 1 > sizeof(depfile_path))
return -1;
- d = depfile_path + depfile_prefix_len;
- strcpy(d, name);
+ strcpy(depfile_path + depfile_prefix_len, name);
- /* Assume directory path already exists. */
fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
- if (fd == -1) {
- if (errno != ENOENT)
- return -1;
-
- ret = make_parent_dir(depfile_path);
- if (ret)
- return ret;
-
- /* Try it again. */
- fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
- if (fd == -1)
- return -1;
- }
+ if (fd == -1)
+ return -1;
close(fd);
return 0;