From nobody Fri Jan 05 00:23:12 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 4T5kh05Fjyz55fTJ; Fri, 5 Jan 2024 00:23:12 +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 4T5kh03S4xz4dwL; Fri, 5 Jan 2024 00:23:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704414192; 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=YuKz+bt4Z5/aaTvePOIYD2UNnFR7ahz/LjzKubLiPD4=; b=OsTZ5m6CZygJoNOdNOz9l7wvz0YdsgDZFlsNQsmcInXLH7eogW6DyfRJDjwWrVH46bkfUb 0SEhqTzuRVn1dHIqlgGLWZ2TmhKf4ZGkwXhFwFhVyLH5X8+MAuwpcKGOxO3QYkOKWAe9CL g2eP4L2oP0o5z+MVR7dStXAjZE/rgtb1hSTVDJ3eL2xOiNrJytACWL7k4FNrUuYXb/MhuG CvFj6UTU4Nab38T7JOv2MINhXKhOtD2tpSUxK2fRt64MjiOf3Zt2BhuKLb+QTXEgh7Ocv3 YsUpEKGtDPrieWodTTBRGYjI2xFhdeRudeSM+YaitxGWCVE/80+jWqXP7TndAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704414192; 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=YuKz+bt4Z5/aaTvePOIYD2UNnFR7ahz/LjzKubLiPD4=; b=rMqglnKzoWHX0Jt4t3/PBwLIc6M/bpxZvm4kYM7LCRLlAe4OJRTnroMF011TNjc2PjYDTe CwS+ccSMkqN1qqYBJik1YMgcp3gpPOi+GTV9rq6s3qXNuTyE/kbLXKBm4BGWxWqCSBAmAg JDaie32WIZNGrwxoXMSpTJ1lNbcHpi8mUhnOlFP0zNI106yTQpzyVYpODwWuDiut/ld0hM UcEMrlf+xDNSRPGMDjflAg102J+7IfrvFT3/xllGkN9TzmgrVWsLnUqeXWA9e4PzyPzTS0 EL53p0kyv1iLCayhxUEouN+xwf5rL006W6SKESg44eDuI9zyh+QDhhwnutJXPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704414192; a=rsa-sha256; cv=none; b=L08l2ZTsk+lCdys0zbHOjvLbQsJpDnzjS1VSFl6eAuYCkDy11TVJk8zaUeReVQsAh3Dzwb h4HrrVy/UTMWDtnvU7rb7SZl0EA7gkUgjd3GbYD0IF7mL9mjXsPWJYzfZ8zNbiH9EjmVW/ oIp8+s9FNH5e7WRpzGiUWpA+hu0iJGCnMLhlKsXbxLlHT5Z7MwGN9CsxTy7DOaVdZltO3L 4BJiCMkUMa5HH+bs9b0sRRLH0e1PccBKHYCWSS7ePJiKkzc5cCRbLeAueOce1gAqrF9kgD 32OocvmHfKsLDvM8eJ9kZP/8mGAdCrrEfX9D0nFMmiK85ihFS/l1k55fYp7X0Q== 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 4T5kh02YkbzbfB; Fri, 5 Jan 2024 00:23:12 +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 4050NCAF025584; Fri, 5 Jan 2024 00:23:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4050NCep025581; Fri, 5 Jan 2024 00:23:12 GMT (envelope-from git) Date: Fri, 5 Jan 2024 00:23:12 GMT Message-Id: <202401050023.4050NCep025581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 2f47321e3f96 - stable/13 - bsdinstall: Filter out devices that cannot be opened 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2f47321e3f96d80bf4fbfad8c2482b93197e03cb Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2f47321e3f96d80bf4fbfad8c2482b93197e03cb commit 2f47321e3f96d80bf4fbfad8c2482b93197e03cb Author: Brad Davis AuthorDate: 2022-05-13 14:33:21 +0000 Commit: John Baldwin CommitDate: 2024-01-05 00:18:53 +0000 bsdinstall: Filter out devices that cannot be opened Devices that cannot be opened are most likely the install media and should not be listed as destinations. Reviewed by: allanjude Approved by: allanjude Differential Revision: https://reviews.freebsd.org/D34879 Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 964ad27f1e48ec28247142cfe6afdfa1f8bd3182) --- usr.sbin/bsdinstall/partedit/part_wizard.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr.sbin/bsdinstall/partedit/part_wizard.c b/usr.sbin/bsdinstall/partedit/part_wizard.c index 90dba58383e2..b790e8b3c4d4 100644 --- a/usr.sbin/bsdinstall/partedit/part_wizard.c +++ b/usr.sbin/bsdinstall/partedit/part_wizard.c @@ -131,6 +131,16 @@ boot_disk_select(struct gmesh *mesh) continue; if (strncmp(pp->lg_name, "cd", 2) == 0) continue; + /* + * Check if the disk is available to be opened for + * write operations, it helps prevent the USB + * stick used to boot from being listed as an option + */ + fd = g_open(pp->lg_name, 1); + if (fd == -1) { + continue; + } + g_close(fd); disks = realloc(disks, (++n)*sizeof(disks[0])); disks[n-1].name = pp->lg_name;