summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_linker.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2002-10-17 17:28:57 +0000
committersam <sam@FreeBSD.org>2002-10-17 17:28:57 +0000
commitbd5a0b8cbafbcbfac0565ca9b24409fc9667d7b3 (patch)
treedb72b75605c44b35836a79f1bf27147e7771335d /sys/kern/kern_linker.c
parent14c86ef8ad65fcded3886bdb2becd7c856b0d8c5 (diff)
downloadFreeBSD-src-bd5a0b8cbafbcbfac0565ca9b24409fc9667d7b3.zip
FreeBSD-src-bd5a0b8cbafbcbfac0565ca9b24409fc9667d7b3.tar.gz
fix kldload error return when a module is rejected because it's statically
linked in the kernel. When this condition is detected deep in the linker internals the EEXIST error code that's returned is stomped on and instead an ENOEXEC code is returned. This makes apps like sysinstall bitch.
Diffstat (limited to 'sys/kern/kern_linker.c')
-rw-r--r--sys/kern/kern_linker.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 0755021..b936159 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -362,10 +362,18 @@ linker_load_file(const char *filename, linker_file_t *result)
* Less than ideal, but tells the user whether it failed to load or
* the module was not found.
*/
- if (foundfile)
- /* Format not recognized (or unloadable). */
- error = ENOEXEC;
- else
+ if (foundfile) {
+ /*
+ * Format not recognized or otherwise unloadable.
+ * When loading a module that is statically built into
+ * the kernel EEXIST percolates back up as the return
+ * value. Preserve this so that apps like sysinstall
+ * can recognize this special case and not post bogus
+ * dialog boxes.
+ */
+ if (error != EEXIST)
+ error = ENOEXEC;
+ } else
error = ENOENT; /* Nothing found */
out:
return (error);
OpenPOWER on IntegriCloud