Author: cem Date: Fri Jun 5 16:05:09 2020 New Revision: 361837 URL: https://svnweb.freebsd.org/changeset/base/361837
Log: geom: Don't re-add duplicate aliases Reviewed by: imp (informal +1; extracted from phab 24968) Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Fri Jun 5 15:09:02 2020 (r361836) +++ head/sys/geom/geom_subr.c Fri Jun 5 16:05:09 2020 (r361837) @@ -652,6 +652,15 @@ g_provider_add_alias(struct g_provider *pp, const char sbuf_vprintf(sb, fmt, ap); va_end(ap); sbuf_finish(sb); + + LIST_FOREACH(gap, &pp->aliases, ga_next) { + if (strcmp(gap->ga_alias, sbuf_data(sb)) != 0) + continue; + /* Don't re-add the same alias. */ + sbuf_delete(sb); + return; + } + gap = g_malloc(sizeof(*gap) + sbuf_len(sb) + 1, M_WAITOK | M_ZERO); memcpy((char *)(gap + 1), sbuf_data(sb), sbuf_len(sb)); sbuf_delete(sb); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"