Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/modules/k_helper3 While we need an absolute path when ...
details: https://anonhg.NetBSD.org/src/rev/b853a30ca297
branches: trunk
changeset: 778870:b853a30ca297
user: martin <martin%NetBSD.org@localhost>
date: Tue Apr 17 21:39:19 2012 +0000
description:
While we need an absolute path when loading a module (including the .kmod
extension), we want the shortname w/o extension for the unload.
diffstat:
tests/modules/k_helper3/k_helper3.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diffs (44 lines):
diff -r 73d896e63c78 -r b853a30ca297 tests/modules/k_helper3/k_helper3.c
--- a/tests/modules/k_helper3/k_helper3.c Tue Apr 17 19:15:15 2012 +0000
+++ b/tests/modules/k_helper3/k_helper3.c Tue Apr 17 21:39:19 2012 +0000
@@ -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 @@
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 @@
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);
Home |
Main Index |
Thread Index |
Old Index