svn commit: trunk/busybox: modutils procps shell util-linux

vda at busybox.net vda at busybox.net
Tue Mar 3 18:47:57 UTC 2009


Author: vda
Date: 2009-03-03 18:47:56 +0000 (Tue, 03 Mar 2009)
New Revision: 25509

Log:
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



Modified:
   trunk/busybox/modutils/modprobe.c
   trunk/busybox/procps/fuser.c
   trunk/busybox/shell/ash.c
   trunk/busybox/util-linux/fdisk.c
   trunk/busybox/util-linux/umount.c


Changeset:
Modified: trunk/busybox/modutils/modprobe.c
===================================================================
--- trunk/busybox/modutils/modprobe.c	2009-03-03 14:55:29 UTC (rev 25508)
+++ trunk/busybox/modutils/modprobe.c	2009-03-03 18:47:56 UTC (rev 25509)
@@ -100,8 +100,7 @@
 	}
 	config_close(p);
 error:
-	if (ENABLE_FEATURE_CLEAN_UP)
-		RELEASE_CONFIG_BUFFER(modname);
+	RELEASE_CONFIG_BUFFER(modname);
 	return rc;
 }
 
@@ -141,8 +140,13 @@
 	int rc = -1;
 
 	p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, fopen_for_read);
+	/* Modprobe does not work at all without modprobe.dep,
+	 * even if the full module name is given. Returning error here
+	 * was making us later confuse user with this message:
+	 * "module /full/path/to/existing/file/module.ko not found".
+	 * It's better to die immediately, with good message: */
 	if (p == NULL)
-		goto error;
+		bb_perror_msg_and_die("can't open '%s'", CONFIG_DEFAULT_DEPMOD_FILE);
 
 	while (config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)) {
 		colon = last_char_is(tokens[0], ':');
@@ -179,23 +183,21 @@
 			rc = bb_init_module(fn, options);
 			if (rc == 0)
 				llist_add_to(&loaded, xstrdup(modname));
-			if (ENABLE_FEATURE_CLEAN_UP)
-				free(options);
+			free(options);
 		}
 
-		if (ENABLE_FEATURE_CLEAN_UP)
-			free(fn);
+		free(fn);
 	}
 
-error_not_found:
+ error_not_found:
 	config_close(p);
-error:
-	if (ENABLE_FEATURE_CLEAN_UP)
-		RELEASE_CONFIG_BUFFER(modname);
+
 	if (rc > 0 && !(option_mask32 & INSMOD_OPT_SILENT))
 		bb_error_msg("failed to %sload module %s: %s",
 			     (option_mask32 & MODPROBE_OPT_REMOVE) ? "un" : "",
 			     module, moderror(rc));
+
+	RELEASE_CONFIG_BUFFER(modname);
 	return rc;
 }
 
@@ -278,8 +280,7 @@
 				char *realname = llist_pop(&conf->aliases);
 				if (check_blacklist(conf, realname))
 					do_modprobe(conf, realname);
-				if (ENABLE_FEATURE_CLEAN_UP)
-					free(realname);
+				free(realname);
 			}
 		}
 		argv++;

Modified: trunk/busybox/procps/fuser.c
===================================================================
--- trunk/busybox/procps/fuser.c	2009-03-03 14:55:29 UTC (rev 25508)
+++ trunk/busybox/procps/fuser.c	2009-03-03 18:47:56 UTC (rev 25509)
@@ -325,7 +325,7 @@
 			free(proto);
 		} else { /* FILE */
 			if (!file_to_dev_inode(*pp, &dev, &inode))
-				bb_perror_msg_and_die("can't open %s", *pp);
+				bb_perror_msg_and_die("can't open '%s'", *pp);
 			ilist = add_inode(ilist, dev, inode);
 		}
 		pp++;

Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2009-03-03 14:55:29 UTC (rev 25508)
+++ trunk/busybox/shell/ash.c	2009-03-03 18:47:56 UTC (rev 25509)
@@ -4540,7 +4540,7 @@
 		if (jp->nprocs == 0) {
 			close(0);
 			if (open(bb_dev_null, O_RDONLY) != 0)
-				ash_msg_and_raise_error("can't open %s", bb_dev_null);
+				ash_msg_and_raise_error("can't open '%s'", bb_dev_null);
 		}
 	}
 	if (!oldlvl) {
@@ -9573,7 +9573,7 @@
 	if (fd < 0) {
 		if (flags & INPUT_NOFILE_OK)
 			goto out;
-		ash_msg_and_raise_error("can't open %s", fname);
+		ash_msg_and_raise_error("can't open '%s'", fname);
 	}
 	if (fd < 10) {
 		fd2 = copyfd(fd, 10);

Modified: trunk/busybox/util-linux/fdisk.c
===================================================================
--- trunk/busybox/util-linux/fdisk.c	2009-03-03 14:55:29 UTC (rev 25508)
+++ trunk/busybox/util-linux/fdisk.c	2009-03-03 18:47:56 UTC (rev 25509)
@@ -83,7 +83,7 @@
 	unsigned char size4[4];         /* nr of sectors in partition */
 } PACKED;
 
-static const char unable_to_open[] ALIGN1 = "can't open %s";
+static const char unable_to_open[] ALIGN1 = "can't open '%s'";
 static const char unable_to_read[] ALIGN1 = "can't read from %s";
 static const char unable_to_seek[] ALIGN1 = "can't seek on %s";
 

Modified: trunk/busybox/util-linux/umount.c
===================================================================
--- trunk/busybox/util-linux/umount.c	2009-03-03 14:55:29 UTC (rev 25508)
+++ trunk/busybox/util-linux/umount.c	2009-03-03 18:47:56 UTC (rev 25509)
@@ -69,7 +69,7 @@
 	fp = setmntent(bb_path_mtab_file, "r");
 	if (!fp) {
 		if (opt & OPT_ALL)
-			bb_error_msg_and_die("can't open %s", bb_path_mtab_file);
+			bb_error_msg_and_die("can't open '%s'", bb_path_mtab_file);
 	} else {
 		while (getmntent_r(fp, &me, path, PATH_MAX)) {
 			/* Match fstype if passed */



More information about the busybox-cvs mailing list