Date: Fri, 16 Apr 2021 02:42:18 GMT From: Ryan Moeller <freqlabs@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 407fb44c920a - main - ifconfig: Reuse media state in ifmedia_getstate Message-ID: <202104160242.13G2gIYd028936@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=407fb44c920a580a30dfe7d1add796a7b35a5ac7 commit 407fb44c920a580a30dfe7d1add796a7b35a5ac7 Author: Ryan Moeller <freqlabs@FreeBSD.org> AuthorDate: 2021-04-16 02:32:25 +0000 Commit: Ryan Moeller <freqlabs@FreeBSD.org> CommitDate: 2021-04-16 02:32:25 +0000 ifconfig: Reuse media state in ifmedia_getstate This restores behavior lost in code cleanup, fixing a regression after 2803fa471e77dc8f227fe00bbf075de7feb10022 where changing media options only applies some of the changes, not all. Reported by: np Reviewed by: donner MFC after: immediately Differential Revision: https://reviews.freebsd.org/D29741 --- sbin/ifconfig/ifmedia.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c index 66eb40254889..aacf34a13248 100644 --- a/sbin/ifconfig/ifmedia.c +++ b/sbin/ifconfig/ifmedia.c @@ -159,7 +159,10 @@ free: struct ifmediareq * ifmedia_getstate(void) { - static struct ifmediareq *ifmr; + static struct ifmediareq *ifmr = NULL; + + if (ifmr != NULL) + return (ifmr); if (ifconfig_media_get_mediareq(lifh, name, &ifmr) == -1) errc(1, ifconfig_err_errno(lifh),
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104160242.13G2gIYd028936>