From nobody Fri Feb 2 15:52:23 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TRKzD4Kmrz590lK; Fri, 2 Feb 2024 15:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TRKzD1gxMz4QGn; Fri, 2 Feb 2024 15:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706889144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wraImFdreCiivDNb3PYq0QX5z9aw1YWUvh4Ti4QhGMg=; b=gd4VM1LotvchOBOFFzkwFNKv8zCKMnTk+12bzpqzZePJGHqt8bWao3WdUE1n1Y8endBLs+ XoXMX4aDEn8XwaP1xjoV2uxGkOn/xAyTiMt1zK4bXGTmSeg7JRfpIc16TsLh3CPW+7WIVq HFC/VIgA9Ustj/aCmz0Fc8LgPw/kTs0mLuxQ2Sdj/Z6v4n6qRMdzKv0DZiUTi18Xe/UFGH 6hPFbmF6FTPlAS/Lb8KTpmaQbkgJMPkzS2ED2FoO5rOUNbu88Yks/JHUiqWH36gVNUiMb6 pUTx8xBqa1S492Y5BLrdHHqF836VluJqwIy6zdO/6BiiHb4DhvyVVYSOXhTuLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706889144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wraImFdreCiivDNb3PYq0QX5z9aw1YWUvh4Ti4QhGMg=; b=gwUxrwoAIih8BhJYL7hQq2oZowKhKsq9auF1aONsj3FsTnrxYByIxFy4rBu36rVZdJ8B00 +L42+D7zLGqxpbH2g34pTMXxAI3NrATmDUWsYyvrJsvaZZdWrDz9uLONLcGcmCGsrCwE+n 6gezUbHVyQ5Vln88wZ+9oTh4XjB+OooZYnmSVR2qU3Kt7N7N2cxNZRO8VdYEY/pABQx+fh rPcIzZ1AfQVPrZGhTF4cK2JaBalIgKE3GmHRTvz/gkQHBcwstWL/A7bHp33RjYTwKUs/+g AGw0xoN5+1u0Fb76yitV+0KQH5UeMSWMQV/70fU2bpRDUpfMDVkUB3IPVwmZvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706889144; a=rsa-sha256; cv=none; b=iLcb1eTg81Hh1pnM6wLfLZuXN7W5JS/L1yIYyqD/yDT9endGki8p5rUMwRD0tQgXCzkEq3 FyyBxJtH1w1MaHgWw9hrK5Gn0rzGXS94M7Qu36nLUdIG6WFks/WsmOGJUFo5s5lg1EMvvs 05g2fvSi/gy3UBzc95gZtwWJ8stwetlDSZtNVz+cesyPQH/NDw6ydwtulz0r+5ZsGwdxqv fKnjYukL7FXxXE8EqCnkvuy4LLGW34hgHaOv1LokelYyZl37s/8sM2xL2s+5pA8CF/Klo+ e9b8eSzM2ZNdrnaLpCJtfgN84p4aKGeI5bHlKGrHyvLy9BaABlkDPsvrBFiWRA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TRKzD0kWjzcfv; Fri, 2 Feb 2024 15:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 412FqND2034035; Fri, 2 Feb 2024 15:52:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 412FqN96034033; Fri, 2 Feb 2024 15:52:23 GMT (envelope-from git) Date: Fri, 2 Feb 2024 15:52:23 GMT Message-Id: <202402021552.412FqN96034033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f4613af424cc - main - kldxref: Fix maketempfile function's way of finding the root dir List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4613af424cc93d42f35730fd9862f0c6f964cbd Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f4613af424cc93d42f35730fd9862f0c6f964cbd commit f4613af424cc93d42f35730fd9862f0c6f964cbd Author: Mina Galić AuthorDate: 2024-02-02 15:35:46 +0000 Commit: Warner Losh CommitDate: 2024-02-02 15:35:49 +0000 kldxref: Fix maketempfile function's way of finding the root dir Rather than assuming that the "root" is passed as directory and will be marked by a trailing slash, we just assume that the directory, which has been checked previously to be a directory, is a directory. This fixes an inconsistency between `kldxref /boot/modules`, which tries to create the temp file in `/boot/`, and `kldxref /boot/modules/`, which tries to create it in `/boot/modules/` itself. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1093 --- usr.sbin/kldxref/kldxref.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c index 1f06ad811d91..969d07e5677a 100644 --- a/usr.sbin/kldxref/kldxref.c +++ b/usr.sbin/kldxref/kldxref.c @@ -717,12 +717,9 @@ read_kld(char *filename, char *kldname) static FILE * maketempfile(char *dest, const char *root) { - char *p; - int n, fd; + int fd; - p = strrchr(root, '/'); - n = p != NULL ? p - root + 1 : 0; - if (snprintf(dest, MAXPATHLEN, "%.*slhint.XXXXXX", n, root) >= + if (snprintf(dest, MAXPATHLEN, "%s/lhint.XXXXXX", root) >= MAXPATHLEN) { errno = ENAMETOOLONG; return (NULL);