blob: b90d75b8896fe53e3a02d9a47862ae5071705723 [file] [log] [blame] [raw]
Fix segmentation fault of mdconfig(8).
diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-src/usr/src/sbin/mdconfig/mdconfig.c freebsd-10.3/usr/src/sbin/mdconfig/mdconfig.c
--- /var/tmp/freebsd-src/usr/src/sbin/mdconfig/mdconfig.c 2016-03-25 09:10:18.000000000 +0800
+++ freebsd-10.3/usr/src/sbin/mdconfig/mdconfig.c 2017-02-09 01:15:03.008387443 +0800
@@ -452,7 +452,14 @@
}
gc = &pp->lg_config;
type = geom_config_get(gc, "type");
- if (strcmp(type, "vnode") == 0) {
+/*
+ if(!type) {
+ //perror("geom_config_get");
+ //return -1;
+ continue;
+ }
+*/
+ if (type && strcmp(type, "vnode") == 0) {
file = geom_config_get(gc, "file");
if (fflag != NULL &&
strcmp(fflag, file) != 0)
@@ -509,8 +516,9 @@
geom_config_get(struct gconf *g, const char *name)
{
struct gconfig *gce;
-
+ fprintf(stderr, "function: geom_config_get(%p, %p<%s>)\n", g, name, name);
LIST_FOREACH(gce, g, lg_config) {
+ fprintf(stderr, "mdconfig: debug: %s: gce->lg_name = \"%s\"\n", __func__, gce->lg_name);
if (strcmp(gce->lg_name, name) == 0)
return (gce->lg_val);
}