git: b8b23cf1122e - stable/15 - virtual_oss(8): Fix cuse.ko check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 10 Oct 2026 18:52:13 UTC
The branch stable/15 has been updated by fernape:
URL: https://cgit.FreeBSD.org/src/commit/?id=b8b23cf1122ed50d18e61f3a7f57cd0c30cbddd9
commit b8b23cf1122ed50d18e61f3a7f57cd0c30cbddd9
Author: Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2026-09-19 16:39:19 +0000
Commit: Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2026-10-10 18:51:55 +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
(cherry picked from commit 5aac18d0faec96c768baf1a9de63a50de3796023)
---
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 5b50f8e5ef6c..b0c88f14a023 100644
--- a/usr.sbin/virtual_oss/virtual_oss/main.c
+++ b/usr.sbin/virtual_oss/virtual_oss/main.c
@@ -2578,6 +2578,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;
@@ -2591,8 +2592,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");