Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp932790pxb; Thu, 30 Sep 2021 22:37:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo+ENfEPJu6/kDIxE8qXyCfXc7AvF+Im0tbpOQbL5+II3lZuaT6eOeJtyoqFY98lR2IIG0 X-Received: by 2002:a05:6402:289b:: with SMTP id eg27mr12473267edb.25.1633066636790; Thu, 30 Sep 2021 22:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633066636; cv=none; d=google.com; s=arc-20160816; b=pzGeOV6VvRX4dGiiClchq4uQ9Vvx2ZuywO1ue2xyJG7hLhA5sU2oZkxTEzkWk3vt9Z mmAMv6M7qRdRNYR4aSSAwWv9lfXxDk6e+u3W8iOOHgH7C/nV/EfZDEIM6KH1m1StOSL+ NSNojTsUm7fNU2hB1wGazV+tGKJx7q15DcXrTJqICBjVBmUTOcN1MWPBZ41Vvqggp0X+ YIf4rDbD8nPqCqJRzulQWX80MK8CMt7ztTWHD2sXxpCxJepzAlq4CkJOUCkVIUBDP3de lHVv4EMeJtL5tElpWlVxkY0q26NAQwLAPUNO2TRQPN3ok5YQZjalO1f5YfpE/HPx8RmN j8PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=Iqm0ebRv9z0IooNy+Maz2A58TgKBK4bu96UGV+0zUbk=; b=dND9IVqJjGiI7oEFq7K5G/f1S1bGs2AvicE0KqWwyBuQ0Cup3d7VQFq5CB+5nPoOV7 LrlqLk+i9p0UVVKYgSDbHJN+v10zy3giY+DQyWehqsZfNv/fyeObBXeoYZxt9T8PSwiQ y07R/UfSlOyd3ewLZLtumoyBuOqu9oZRhu8LirBN7iPfiUd/fZ7tuv4mjlbGdEt6Bx50 UBlqt6j4DMfIEW7u5QbVfNAnnaRrH5n+SyjniC0YuVSl4tchdNGyiUhhW5WQFN8AKNOn Hmoe4YHDkfLg/95mUvPlodSVmVEekmhwFW6y7hE7gMZaYh/tgJyAjZPh8j1i+D0DwUNL +LjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="XoK5/WIO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 3si6539618ejy.586.2021.09.30.22.36.52; Thu, 30 Sep 2021 22:37:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="XoK5/WIO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352144AbhJAFfa (ORCPT + 99 others); Fri, 1 Oct 2021 01:35:30 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:25300 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351929AbhJAFfH (ORCPT ); Fri, 1 Oct 2021 01:35:07 -0400 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-10.nifty.com with ESMTP id 1915WwVb000646; Fri, 1 Oct 2021 14:33:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 1915WwVb000646 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1633066383; bh=Iqm0ebRv9z0IooNy+Maz2A58TgKBK4bu96UGV+0zUbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XoK5/WIOrS1P3CE36GBpfutpt7q9hacupBQSM4JdI8ggAvvAJM2Pp9YqZGqMRluha wX5yGYIppYOr8kvCTWD/oIgEm54K6QYj7zJ3/lvyayk1FrWjCdSGrfcMkYGaGelxUv rmUSPZbZ5xVwePpBQv8pzDnvsNe0XV7LCJM3ftJzP1DRW7Byrelk0mV3YAnf1gqXtA AXzCHE2GbsaoQlK1lXN4DuD91yym18UAdKBxRpAt+iT0BWif9Qlcheq+MnC0m5vyeW Q1QjfhpV+DesCBKFesqVTDOxv5zlEGVEUphN6fHKrmjgr5xp8hExFeQRwumxjdsZZD TP2dV6bQ/h+pw== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 09/10] kconfig: refactor conf_touch_dep() Date: Fri, 1 Oct 2021 14:32:52 +0900 Message-Id: <20211001053253.1223316-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211001053253.1223316-1-masahiroy@kernel.org> References: <20211001053253.1223316-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- scripts/kconfig/confdata.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 75e45e69d660..9ece2f3b61a6 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; -- 2.30.2