Module Name: src
Committed By: martin
Date: Tue Apr 17 21:39:19 UTC 2012
Modified Files:
src/tests/modules/k_helper3: k_helper3.c
Log Message:
While we need an absolute path when loading a module (including the .kmod
extension), we want the shortname w/o extension for the unload.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/modules/k_helper3/k_helper3.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/modules/k_helper3/k_helper3.c
diff -u src/tests/modules/k_helper3/k_helper3.c:1.2 src/tests/modules/k_helper3/k_helper3.c:1.3
--- src/tests/modules/k_helper3/k_helper3.c:1.2 Tue Apr 17 05:18:54 2012
+++ src/tests/modules/k_helper3/k_helper3.c Tue Apr 17 21:39:19 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: k_helper3.c,v 1.2 2012/04/17 05:18:54 jruoho Exp $ */
+/* $NetBSD: k_helper3.c,v 1.3 2012/04/17 21:39:19 martin Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: k_helper3.c,v 1.2 2012/04/17 05:18:54 jruoho Exp $");
+__RCSID("$NetBSD: k_helper3.c,v 1.3 2012/04/17 21:39:19 martin Exp $");
#include <sys/module.h>
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
static __printflike(1, 2) int
load(const char *fmt, ...)
{
- char filename[MAXPATHLEN], *propsstr;
+ char filename[MAXPATHLEN], *propsstr, *shortname, *dot;
prop_dictionary_t props;
modctl_load_t ml;
int serrno, rv;
@@ -86,7 +86,15 @@ load(const char *fmt, ...)
if (rv != 0)
serrno = errno;
- (void)modctl(MODCTL_UNLOAD, filename);
+ shortname = strrchr(filename, '/');
+ if (shortname != NULL)
+ shortname++;
+ else
+ shortname = filename;
+ dot = strrchr(shortname, '.');
+ if (dot)
+ *dot = 0;
+ (void)modctl(MODCTL_UNLOAD, shortname);
free(propsstr);