From owner-svn-src-head@freebsd.org Fri Jul 28 18:11:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41DF2DCB4AA; Fri, 28 Jul 2017 18:11:55 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F0426A96C; Fri, 28 Jul 2017 18:11:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SIBrBP000429; Fri, 28 Jul 2017 18:11:53 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SIBrH6000428; Fri, 28 Jul 2017 18:11:53 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707281811.v6SIBrH6000428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 28 Jul 2017 18:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321658 - head/usr.sbin/binmiscctl X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/usr.sbin/binmiscctl X-SVN-Commit-Revision: 321658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 18:11:55 -0000 Author: sbruno Date: Fri Jul 28 18:11:53 2017 New Revision: 321658 URL: https://svnweb.freebsd.org/changeset/base/321658 Log: binmiscctl should use modfind instead of kldfind kldfind() only matches kernel modules, so if you link imgact_binmisc directly into the kernel, binmiscctl can't find it, tries to load it, and errors out with: Can't load imgact_binmisc kernel module: File exists A quick search of other base commands shows that the correct procedure is to call modfind(), and then try kldload() if that fails. PR: 218593 Submitted by: Dan Nelson MFC after: 1 week Modified: head/usr.sbin/binmiscctl/binmiscctl.c Modified: head/usr.sbin/binmiscctl/binmiscctl.c ============================================================================== --- head/usr.sbin/binmiscctl/binmiscctl.c Fri Jul 28 18:09:41 2017 (r321657) +++ head/usr.sbin/binmiscctl/binmiscctl.c Fri Jul 28 18:11:53 2017 (r321658) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include enum cmd { @@ -401,7 +402,7 @@ main(int argc, char **argv) size_t xbe_out_sz = 0, *xbe_out_szp = NULL; uint32_t i; - if (kldfind(KMOD_NAME) == -1) { + if (modfind(KMOD_NAME) == -1) { if (kldload(KMOD_NAME) == -1) fatal("Can't load %s kernel module: %s", KMOD_NAME, strerror(errno));