Subject: bin/7352: modload uses wrong entry point if output file BUT NOT entry specified
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rafal@mediaone.net>
List: netbsd-bugs
Date: 04/09/1999 23:41:59
>Number:         7352
>Category:       bin
>Synopsis:       modload uses wrong entry point if output file BUT NOT entry specified
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr  9 20:50:00 1999
>Last-Modified:
>Originator:     Rafal Boni
>Organization:
dis-
>Release:        -current and 1.4_ALPHA (noted ~ 3/29, checked yesterday)
>Environment:
System: NetBSD doppelganger 1.3K NetBSD 1.3K (DOPPELGANGER) #1: Thu Mar 11 16:58:44 EST 1999 root@groo-the-wanderer.old-oak.net:/usr/src/sys/arch/i386/compile/DOPPELGANGER i386


>Description:
	If the entry point is not passed to modload, on the expectation that
	modload will use <modname>_lkmentry as the entry point, but an output
	file *IS* passed, modload will try <modname>.o_lkmentry instead of
	<modname>_lkmentry (where <modname> is input file stripped of '.o'
	extension).

>How-To-Repeat:
	# /sbin/modload -o /tmp/mod.$$ mod.o

	See complaint about _mod.o_lkmentry being undefined, when what you
	really wanted was _mod_lkmentry.

>Fix:

--- modload.c.orig	Fri Apr  9 23:22:54 1999
+++ modload.c	Fri Apr  9 23:23:26 1999
@@ -266,10 +266,12 @@
 	p = strrchr(modout, '.');
 	if (!p || strcmp(p, ".o"))
 		errx(2, "module object must end in .o");
-	if (out == NULL) {
-		out = modout;
+
 		*p = '\0';
-	}
+
+	if (out == NULL)
+		out = modout;
+
 
 	/*
 	 * Verify that the entry point for the module exists.
>Audit-Trail:
>Unformatted: