git: 5aac18d0faec - main - virtual_oss(8): Fix cuse.ko check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Sep 2026 15:50:57 UTC
The branch main has been updated by fernape:
URL: https://cgit.FreeBSD.org/src/commit/?id=5aac18d0faec96c768baf1a9de63a50de3796023
commit 5aac18d0faec96c768baf1a9de63a50de3796023
Author: Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2026-09-19 16:39:19 +0000
Commit: Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2026-09-25 15:49:36 +0000
virtual_oss(8): Fix cuse.ko check
There is no need at all to load the cuse module to just access the tool help.
kldload always checks for permissions first returning -EPERM if the user can't
load modules and -EEXIST if the user can, but the module is already loaded.
Approved by: christos@
Differential Revision: https://reviews.freebsd.org/D59844
MFC after: 2 weeks
---
usr.sbin/virtual_oss/virtual_oss/main.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c
index 1b03e2c8cf37..7536fd72f98f 100644
--- a/usr.sbin/virtual_oss/virtual_oss/main.c
+++ b/usr.sbin/virtual_oss/virtual_oss/main.c
@@ -2564,6 +2564,7 @@ int
main(int argc, char **argv)
{
const char *ptrerr;
+ const char *cuse_mod = "cuse.ko";
struct sigaction sa;
struct cuse_dev *pdev = NULL;
struct virtual_profile *pvp;
@@ -2583,8 +2584,10 @@ main(int argc, char **argv)
atomic_init();
- if (kldload("cuse.ko") < 0 && errno != EEXIST)
- err(1, "Failed to load cuse kernel module");
+ if ((kldfind(cuse_mod) < 0 && errno == ENOENT) &&
+ (kldload(cuse_mod) < 0 && errno != EEXIST)) {
+ err(1, "Failed to load %s", cuse_mod);
+ }
if (cuse_init() != 0)
errx(EX_USAGE, "Could not connect to cuse module");