diff options
-rw-r--r-- | loader/devices.c | 5 | ||||
-rw-r--r-- | loader/modules.c | 24 |
2 files changed, 28 insertions, 1 deletions
diff --git a/loader/devices.c b/loader/devices.c index 9b9fb858a..a7bfbe4a1 100644 --- a/loader/devices.c +++ b/loader/devices.c @@ -12,6 +12,7 @@ #include "../isys/isys.h" #include "lang.h" #include "loader.h" +#include "log.h" #include "misc.h" #include "modules.h" #include "windows.h" @@ -352,6 +353,10 @@ int devDeviceMenu(enum driverMajor type, moduleInfoSet modInfo, free(args); } + if (rc) + newtWinMessage(_("Error"), _("Failed to insert %s module."), + mod->moduleName); + if (!rc && moduleName) *moduleName = mod->moduleName; diff --git a/loader/modules.c b/loader/modules.c index 8a3d2f8f9..5c8de1910 100644 --- a/loader/modules.c +++ b/loader/modules.c @@ -6,6 +6,7 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> +#include <sys/wait.h> #include <unistd.h> #include "isys/isys.h" @@ -200,6 +201,8 @@ int mlLoadModule(char * modName, char * path, moduleList modLoaded, char ** arg, ** newArgs; struct moduleInfo * mi; int ethDevices = -1; + pid_t child; + int status; if (mlModuleInList(modName, modLoaded)) { return 0; @@ -237,7 +240,26 @@ int mlLoadModule(char * modName, char * path, moduleList modLoaded, } else { logMessage("going to insmod %s (path is %s)", fileName, path ? path : "NULL"); - rc = insmod(fileName, path, args); + + if (!(child = fork())) { + int fd = open("/dev/tty3", O_RDWR); + + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + close(fd); + + rc = insmod(fileName, path, args); + _exit(rc); + } + + waitpid(child, &status, 0); + + if (!WIFEXITED(status) || WEXITSTATUS(status)) { + rc = 1; + } else { + rc = 0; + } } if (!rc) { |