aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-03 18:47:56 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-03 18:47:56 +0000
commit9604e1b8fc1e6c64fb977791d5f2819389a37377 (patch)
tree072ba5f8e13dbbc380147c79468ed77fa8e1ae3b
parent787a492f23bbd567fb9bf2486ce9994bd19ebec2 (diff)
downloadbusybox-w32-9604e1b8fc1e6c64fb977791d5f2819389a37377.tar.gz
busybox-w32-9604e1b8fc1e6c64fb977791d5f2819389a37377.tar.bz2
busybox-w32-9604e1b8fc1e6c64fb977791d5f2819389a37377.zip
modprobe: emit "can't open 'modules.dep': (errno)" instead of "module not found"
*: s/can't open %s/can't open '%s'/, it's better to use same string. function old new delta do_modprobe 588 601 +13 config_file_action 339 345 +6 modprobe_main 565 570 +5 unable_to_open 14 16 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 26/0) Total: 26 bytes text data bss dec hex filename 816800 476 7892 825168 c9750 busybox_old 816812 476 7892 825180 c975c busybox_unstripped
-rw-r--r--modutils/modprobe.c27
-rw-r--r--procps/fuser.c2
-rw-r--r--shell/ash.c4
-rw-r--r--util-linux/fdisk.c2
-rw-r--r--util-linux/umount.c2
5 files changed, 19 insertions, 18 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index ad39be059..945483327 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -100,8 +100,7 @@ static int FAST_FUNC config_file_action(const char *filename,
100 } 100 }
101 config_close(p); 101 config_close(p);
102error: 102error:
103 if (ENABLE_FEATURE_CLEAN_UP) 103 RELEASE_CONFIG_BUFFER(modname);
104 RELEASE_CONFIG_BUFFER(modname);
105 return rc; 104 return rc;
106} 105}
107 106
@@ -141,8 +140,13 @@ static int do_modprobe(struct modprobe_conf *conf, const char *module)
141 int rc = -1; 140 int rc = -1;
142 141
143 p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, fopen_for_read); 142 p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, fopen_for_read);
143 /* Modprobe does not work at all without modprobe.dep,
144 * even if the full module name is given. Returning error here
145 * was making us later confuse user with this message:
146 * "module /full/path/to/existing/file/module.ko not found".
147 * It's better to die immediately, with good message: */
144 if (p == NULL) 148 if (p == NULL)
145 goto error; 149 bb_perror_msg_and_die("can't open '%s'", CONFIG_DEFAULT_DEPMOD_FILE);
146 150
147 while (config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)) { 151 while (config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)) {
148 colon = last_char_is(tokens[0], ':'); 152 colon = last_char_is(tokens[0], ':');
@@ -179,23 +183,21 @@ static int do_modprobe(struct modprobe_conf *conf, const char *module)
179 rc = bb_init_module(fn, options); 183 rc = bb_init_module(fn, options);
180 if (rc == 0) 184 if (rc == 0)
181 llist_add_to(&loaded, xstrdup(modname)); 185 llist_add_to(&loaded, xstrdup(modname));
182 if (ENABLE_FEATURE_CLEAN_UP) 186 free(options);
183 free(options);
184 } 187 }
185 188
186 if (ENABLE_FEATURE_CLEAN_UP) 189 free(fn);
187 free(fn);
188 } 190 }
189 191
190error_not_found: 192 error_not_found:
191 config_close(p); 193 config_close(p);
192error: 194
193 if (ENABLE_FEATURE_CLEAN_UP)
194 RELEASE_CONFIG_BUFFER(modname);
195 if (rc > 0 && !(option_mask32 & INSMOD_OPT_SILENT)) 195 if (rc > 0 && !(option_mask32 & INSMOD_OPT_SILENT))
196 bb_error_msg("failed to %sload module %s: %s", 196 bb_error_msg("failed to %sload module %s: %s",
197 (option_mask32 & MODPROBE_OPT_REMOVE) ? "un" : "", 197 (option_mask32 & MODPROBE_OPT_REMOVE) ? "un" : "",
198 module, moderror(rc)); 198 module, moderror(rc));
199
200 RELEASE_CONFIG_BUFFER(modname);
199 return rc; 201 return rc;
200} 202}
201 203
@@ -278,8 +280,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
278 char *realname = llist_pop(&conf->aliases); 280 char *realname = llist_pop(&conf->aliases);
279 if (check_blacklist(conf, realname)) 281 if (check_blacklist(conf, realname))
280 do_modprobe(conf, realname); 282 do_modprobe(conf, realname);
281 if (ENABLE_FEATURE_CLEAN_UP) 283 free(realname);
282 free(realname);
283 } 284 }
284 } 285 }
285 argv++; 286 argv++;
diff --git a/procps/fuser.c b/procps/fuser.c
index 7297bfe66..dc3d01bda 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -325,7 +325,7 @@ Find processes which use FILEs or PORTs
325 free(proto); 325 free(proto);
326 } else { /* FILE */ 326 } else { /* FILE */
327 if (!file_to_dev_inode(*pp, &dev, &inode)) 327 if (!file_to_dev_inode(*pp, &dev, &inode))
328 bb_perror_msg_and_die("can't open %s", *pp); 328 bb_perror_msg_and_die("can't open '%s'", *pp);
329 ilist = add_inode(ilist, dev, inode); 329 ilist = add_inode(ilist, dev, inode);
330 } 330 }
331 pp++; 331 pp++;
diff --git a/shell/ash.c b/shell/ash.c
index 3abca75fe..b33351674 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4540,7 +4540,7 @@ forkchild(struct job *jp, /*union node *n,*/ int mode)
4540 if (jp->nprocs == 0) { 4540 if (jp->nprocs == 0) {
4541 close(0); 4541 close(0);
4542 if (open(bb_dev_null, O_RDONLY) != 0) 4542 if (open(bb_dev_null, O_RDONLY) != 0)
4543 ash_msg_and_raise_error("can't open %s", bb_dev_null); 4543 ash_msg_and_raise_error("can't open '%s'", bb_dev_null);
4544 } 4544 }
4545 } 4545 }
4546 if (!oldlvl) { 4546 if (!oldlvl) {
@@ -9573,7 +9573,7 @@ setinputfile(const char *fname, int flags)
9573 if (fd < 0) { 9573 if (fd < 0) {
9574 if (flags & INPUT_NOFILE_OK) 9574 if (flags & INPUT_NOFILE_OK)
9575 goto out; 9575 goto out;
9576 ash_msg_and_raise_error("can't open %s", fname); 9576 ash_msg_and_raise_error("can't open '%s'", fname);
9577 } 9577 }
9578 if (fd < 10) { 9578 if (fd < 10) {
9579 fd2 = copyfd(fd, 10); 9579 fd2 = copyfd(fd, 10);
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index b1f0b65c6..dc61e238a 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -83,7 +83,7 @@ struct partition {
83 unsigned char size4[4]; /* nr of sectors in partition */ 83 unsigned char size4[4]; /* nr of sectors in partition */
84} PACKED; 84} PACKED;
85 85
86static const char unable_to_open[] ALIGN1 = "can't open %s"; 86static const char unable_to_open[] ALIGN1 = "can't open '%s'";
87static const char unable_to_read[] ALIGN1 = "can't read from %s"; 87static const char unable_to_read[] ALIGN1 = "can't read from %s";
88static const char unable_to_seek[] ALIGN1 = "can't seek on %s"; 88static const char unable_to_seek[] ALIGN1 = "can't seek on %s";
89 89
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 0662cea1b..901c9094f 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -69,7 +69,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
69 fp = setmntent(bb_path_mtab_file, "r"); 69 fp = setmntent(bb_path_mtab_file, "r");
70 if (!fp) { 70 if (!fp) {
71 if (opt & OPT_ALL) 71 if (opt & OPT_ALL)
72 bb_error_msg_and_die("can't open %s", bb_path_mtab_file); 72 bb_error_msg_and_die("can't open '%s'", bb_path_mtab_file);
73 } else { 73 } else {
74 while (getmntent_r(fp, &me, path, PATH_MAX)) { 74 while (getmntent_r(fp, &me, path, PATH_MAX)) {
75 /* Match fstype if passed */ 75 /* Match fstype if passed */