summaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorEric Andersen2000-06-22 18:19:31 +0000
committerEric Andersen2000-06-22 18:19:31 +0000
commit8a24a6783af7a0d54b1f2ebcda5b07757bd19c99 (patch)
tree701225f0b71041b7d4b47b7d8f25d26475fd323c /modutils
parent4a971aef5996f1bc87880000e97dbd480adb75a2 (diff)
downloadbusybox-8a24a6783af7a0d54b1f2ebcda5b07757bd19c99.zip
busybox-8a24a6783af7a0d54b1f2ebcda5b07757bd19c99.tar.gz
Better error checking in insmod. Remove left over %m's
-Erik
Diffstat (limited to 'modutils')
-rw-r--r--modutils/insmod.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 9a6bf0f..f6575c9 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -71,7 +71,7 @@
#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.9 2000/06/19 19:53:30 andersen Exp $"
+#ident "$Id: insmod.c,v 1.10 2000/06/22 18:19:31 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -277,7 +277,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.9 2000/06/19 19:53:30 andersen Exp $"
+#ident "$Id: insmod.c,v 1.10 2000/06/22 18:19:31 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -1210,9 +1210,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- fprintf(stderr,
- "improperly terminated string argument for %s\n",
- p);
+ fprintf(stderr, "improperly terminated string argument for %s\n", p);
return 0;
} else if (*q == '\\')
switch (*++q) {
@@ -1341,7 +1339,7 @@ static int old_get_kernel_symbols(void)
nks = get_kernel_syms(NULL);
if (nks < 0) {
- perror("get_kernel_syms: %m");
+ errorMsg("get_kernel_syms: %s: %s", m_name, strerror(errno));
return 0;
}
@@ -1522,7 +1520,7 @@ old_init_module(const char *m_name, struct obj_file *f,
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
: 0), &routines, symtab);
if (ret)
- perror("init_module: %m");
+ errorMsg("init_module: %s: %s", m_name, strerror(errno));
free(image);
free(symtab);
@@ -1837,7 +1835,7 @@ static int new_get_kernel_symbols(void)
module_names = xrealloc(module_names, bufsize = ret);
goto retry_modules_load;
}
- perror("QM_MODULES: %m\n");
+ errorMsg("QM_MODULES: %s", strerror(errno));
return 0;
}
@@ -1856,7 +1854,7 @@ static int new_get_kernel_symbols(void)
/* The module was removed out from underneath us. */
continue;
}
- perror("query_module: QM_INFO: %m");
+ errorMsg("query_module: QM_INFO: %s: %s", mn, strerror(errno));
return 0;
}
@@ -1871,7 +1869,7 @@ static int new_get_kernel_symbols(void)
/* The module was removed out from underneath us. */
continue;
default:
- perror("query_module: QM_SYMBOLS: %m");
+ errorMsg("query_module: QM_SYMBOLS: %s: %s", mn, strerror(errno));
return 0;
}
}
@@ -1896,7 +1894,7 @@ static int new_get_kernel_symbols(void)
syms = xrealloc(syms, bufsize = ret);
goto retry_kern_sym_load;
}
- perror("kernel: QM_SYMBOLS: %m");
+ errorMsg("kernel: QM_SYMBOLS: %s", strerror(errno));
return 0;
}
nksyms = nsyms = ret;
@@ -2077,7 +2075,7 @@ new_init_module(const char *m_name, struct obj_file *f,
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
- perror("init_module: %m");
+ errorMsg("init_module: %s: %s", m_name, strerror(errno));
free(image);
@@ -2457,7 +2455,7 @@ struct obj_file *obj_load(FILE * fp)
fseek(fp, 0, SEEK_SET);
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
- perror("error reading ELF header: %m");
+ errorMsg("error reading ELF header: %s", strerror(errno));
return NULL;
}
@@ -2496,7 +2494,7 @@ struct obj_file *obj_load(FILE * fp)
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
fseek(fp, f->header.e_shoff, SEEK_SET);
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
- perror("error reading ELF section headers: %m");
+ errorMsg("error reading ELF section headers: %s", strerror(errno));
return NULL;
}
@@ -2526,8 +2524,7 @@ struct obj_file *obj_load(FILE * fp)
sec->contents = xmalloc(sec->header.sh_size);
fseek(fp, sec->header.sh_offset, SEEK_SET);
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
- fprintf(stderr,
- "error reading ELF section data: %m\n");
+ errorMsg("error reading ELF section data: %s", strerror(errno));
return NULL;
}
} else {
@@ -2724,8 +2721,7 @@ extern int insmod_main( int argc, char **argv)
if (m_filename[0] == '\0'
|| ((fp = fopen(m_filename, "r")) == NULL))
{
- perror("No module by that name found in " _PATH_MODULES
- "\n");
+ errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
exit(FALSE);
}
}
@@ -2857,7 +2853,7 @@ extern int insmod_main( int argc, char **argv)
m_size);
goto out;
default:
- perror("create_module: %m");
+ errorMsg("create_module: %s: %s", m_name, strerror(errno));
goto out;
}