diff options
| author | Fernando ApesteguĂa <fernape@FreeBSD.org> | 2026-09-19 16:39:19 +0000 |
|---|---|---|
| committer | Fernando ApesteguĂa <fernape@FreeBSD.org> | 2026-09-25 15:49:36 +0000 |
| commit | 5aac18d0faec96c768baf1a9de63a50de3796023 (patch) | |
| tree | 9f00c831bfc065731fb4dd7c0886d14e3ded773f | |
| parent | 75c0a83762047c6c95c4bdd6b07bad005dc1d99e (diff) | |
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
| -rw-r--r-- | usr.sbin/virtual_oss/virtual_oss/main.c | 7 |
1 files 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"); |
