Date: Fri, 5 Jun 2020 16:05:10 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361837 - head/sys/geom Message-ID: <202006051605.055G5AgY003343@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006051605.055G5AgY003343>