diff -ur -L - - usr/src/uts/common/krtld/kobj.c
--- -
+++ usr/src/uts/common/krtld/kobj.c	2005-09-05 10:59:02.520797000 +0200
@@ -3195,6 +3195,25 @@
 }
 
 /*
+ * Determine if the module exists.
+ */
+int
+kobj_path_exists(char *name, int use_path)
+{
+	struct _buf *file;
+
+	file = kobj_open_path(name, use_path, 1);
+#ifdef MODDIR_SUFFIX
+	if (file == (struct _buf *)-1)
+	file = kobj_open_path(name, use_path, 0);
+#endif /* MODDIR_SUFFIX */
+	if (file == (struct _buf *)-1)
+	return (0);
+	kobj_close_file(file);
+	return (1);
+}
+
+/*
  * fullname is dynamically allocated to be able to hold the
  * maximum size string that can be constructed from name.
  * path is exactly like the shell PATH variable.
diff -ur -L - - usr/src/uts/common/krtld/kobj_stubs.c
--- -
+++ usr/src/uts/common/krtld/kobj_stubs.c	2005-09-05 10:59:02.584976000 +0200
@@ -55,6 +55,13 @@
 {}
 
 /*ARGSUSED*/
+int
+kobj_path_exists(char *name, int use_path)
+{
+	return (0);
+}
+
+/*ARGSUSED*/
 struct _buf *
 kobj_open_path(char *name, int use_path, int use_moddir_suffix)
 {
diff -ur -L - - usr/src/uts/common/krtld/mapfile
--- -
+++ usr/src/uts/common/krtld/mapfile	2005-09-05 10:59:02.586152000 +0200
@@ -49,6 +49,7 @@
 		kobj_notify_remove;
 		kobj_open;
 		kobj_open_file;
+		kobj_path_exists;
 		kobj_open_path;
 		kobj_read;
 		kobj_read_file;
diff -ur -L - - usr/src/uts/common/os/modctl.c
--- -
+++ usr/src/uts/common/os/modctl.c	2005-09-05 11:23:30.943341000 +0200
@@ -2262,23 +2262,15 @@
 {
 	struct modctl *modp;
 	int retval;
-	struct _buf *file;
-
 	/*
 	 * Verify that that module in question actually exists on disk
 	 * before allocation of module structure by mod_hold_by_name.
 	 */
 	if (modrootloaded && swaploaded) {
-		file = kobj_open_path(name, usepath, 1);
-#ifdef	MODDIR_SUFFIX
-		if (file == (struct _buf *)-1)
-			file = kobj_open_path(name, usepath, 0);
-#endif	/* MODDIR_SUFFIX */
-		if (file == (struct _buf *)-1) {
+			if (!kobj_path_exists(name, usepath)) {
 			*r = ENOENT;
 			return (NULL);
 		}
-		kobj_close_file(file);
 	}
 
 	/*
diff -ur -L - - usr/src/uts/common/sys/kobj.h
--- -
+++ usr/src/uts/common/sys/kobj.h	2005-09-05 11:24:37.821486000 +0200
@@ -189,6 +189,7 @@
 extern char *kobj_searchsym(struct module *, uintptr_t, ulong_t *);
 
 extern intptr_t kobj_open(char *);
+extern int kobj_path_exists(char *, int);
 extern struct _buf *kobj_open_path(char *, int, int);
 extern int kobj_read(intptr_t, char *, unsigned int, unsigned int);
 extern void kobj_close(intptr_t);
diff -ur -L - - usr/src/uts/sparc/krtld/mapfile
--- -
+++ usr/src/uts/sparc/krtld/mapfile	2005-09-05 10:59:02.588484000 +0200
@@ -48,6 +48,7 @@
 		kobj_notify_remove;
 		kobj_open;
 		kobj_open_file;
+		kobj_path_exists;
 		kobj_open_path;
 		kobj_read;
 		kobj_read_file;
