aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--insmod.c8
-rw-r--r--modutils/insmod.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/insmod.c b/insmod.c
index 0da0a3962..58273521f 100644
--- a/insmod.c
+++ b/insmod.c
@@ -81,7 +81,7 @@
81#ifndef MODUTILS_MODULE_H 81#ifndef MODUTILS_MODULE_H
82static const int MODUTILS_MODULE_H = 1; 82static const int MODUTILS_MODULE_H = 1;
83 83
84#ident "$Id: insmod.c,v 1.46 2001/02/14 21:23:06 andersen Exp $" 84#ident "$Id: insmod.c,v 1.47 2001/02/15 19:07:43 andersen Exp $"
85 85
86/* This file contains the structures used by the 2.0 and 2.1 kernels. 86/* This file contains the structures used by the 2.0 and 2.1 kernels.
87 We do not use the kernel headers directly because we do not wish 87 We do not use the kernel headers directly because we do not wish
@@ -287,7 +287,7 @@ int delete_module(const char *);
287#ifndef MODUTILS_OBJ_H 287#ifndef MODUTILS_OBJ_H
288static const int MODUTILS_OBJ_H = 1; 288static const int MODUTILS_OBJ_H = 1;
289 289
290#ident "$Id: insmod.c,v 1.46 2001/02/14 21:23:06 andersen Exp $" 290#ident "$Id: insmod.c,v 1.47 2001/02/15 19:07:43 andersen Exp $"
291 291
292/* The relocatable object is manipulated using elfin types. */ 292/* The relocatable object is manipulated using elfin types. */
293 293
@@ -2880,6 +2880,7 @@ extern int insmod_main( int argc, char **argv)
2880 ElfW(Addr) m_addr; 2880 ElfW(Addr) m_addr;
2881 FILE *fp; 2881 FILE *fp;
2882 struct obj_file *f; 2882 struct obj_file *f;
2883 struct stat st;
2883 char m_name[BUFSIZ + 1] = "\0"; 2884 char m_name[BUFSIZ + 1] = "\0";
2884 int exit_status = EXIT_FAILURE; 2885 int exit_status = EXIT_FAILURE;
2885 int m_has_modinfo; 2886 int m_has_modinfo;
@@ -2941,7 +2942,8 @@ extern int insmod_main( int argc, char **argv)
2941 strcat(m_fullName, ".o"); 2942 strcat(m_fullName, ".o");
2942 2943
2943 /* Get a filedesc for the module */ 2944 /* Get a filedesc for the module */
2944 if ((fp = fopen(argv[optind], "r")) == NULL) { 2945 if (stat(argv[optind], &st) < 0 || !S_ISREG(st.st_mode) ||
2946 (fp = fopen(argv[optind], "r")) == NULL) {
2945 /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ 2947 /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */
2946 if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE, 2948 if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE,
2947 findNamedModule, 0, m_fullName) == FALSE) 2949 findNamedModule, 0, m_fullName) == FALSE)
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 0da0a3962..58273521f 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -81,7 +81,7 @@
81#ifndef MODUTILS_MODULE_H 81#ifndef MODUTILS_MODULE_H
82static const int MODUTILS_MODULE_H = 1; 82static const int MODUTILS_MODULE_H = 1;
83 83
84#ident "$Id: insmod.c,v 1.46 2001/02/14 21:23:06 andersen Exp $" 84#ident "$Id: insmod.c,v 1.47 2001/02/15 19:07:43 andersen Exp $"
85 85
86/* This file contains the structures used by the 2.0 and 2.1 kernels. 86/* This file contains the structures used by the 2.0 and 2.1 kernels.
87 We do not use the kernel headers directly because we do not wish 87 We do not use the kernel headers directly because we do not wish
@@ -287,7 +287,7 @@ int delete_module(const char *);
287#ifndef MODUTILS_OBJ_H 287#ifndef MODUTILS_OBJ_H
288static const int MODUTILS_OBJ_H = 1; 288static const int MODUTILS_OBJ_H = 1;
289 289
290#ident "$Id: insmod.c,v 1.46 2001/02/14 21:23:06 andersen Exp $" 290#ident "$Id: insmod.c,v 1.47 2001/02/15 19:07:43 andersen Exp $"
291 291
292/* The relocatable object is manipulated using elfin types. */ 292/* The relocatable object is manipulated using elfin types. */
293 293
@@ -2880,6 +2880,7 @@ extern int insmod_main( int argc, char **argv)
2880 ElfW(Addr) m_addr; 2880 ElfW(Addr) m_addr;
2881 FILE *fp; 2881 FILE *fp;
2882 struct obj_file *f; 2882 struct obj_file *f;
2883 struct stat st;
2883 char m_name[BUFSIZ + 1] = "\0"; 2884 char m_name[BUFSIZ + 1] = "\0";
2884 int exit_status = EXIT_FAILURE; 2885 int exit_status = EXIT_FAILURE;
2885 int m_has_modinfo; 2886 int m_has_modinfo;
@@ -2941,7 +2942,8 @@ extern int insmod_main( int argc, char **argv)
2941 strcat(m_fullName, ".o"); 2942 strcat(m_fullName, ".o");
2942 2943
2943 /* Get a filedesc for the module */ 2944 /* Get a filedesc for the module */
2944 if ((fp = fopen(argv[optind], "r")) == NULL) { 2945 if (stat(argv[optind], &st) < 0 || !S_ISREG(st.st_mode) ||
2946 (fp = fopen(argv[optind], "r")) == NULL) {
2945 /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ 2947 /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */
2946 if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE, 2948 if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE,
2947 findNamedModule, 0, m_fullName) == FALSE) 2949 findNamedModule, 0, m_fullName) == FALSE)