Date: Thu, 10 Sep 2009 09:45:17 +0200 From: Norbert Koch <nkoch@demig.de> To: John Baldwin <jhb@freebsd.org> Cc: freebsd-current@freebsd.org Subject: Re: lock order reversal etc. Message-ID: <4AA8AE8D.7080307@demig.de> In-Reply-To: <200909091507.32600.jhb@freebsd.org> References: <4AA7D4BA.40002@demig.de> <200909091507.32600.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin schrieb: > Try this patch for this one: > > Index: daemon_saver.c > =================================================================== > --- daemon_saver.c (revision 196974) > +++ daemon_saver.c (working copy) > @@ -351,11 +351,23 @@ > static int > daemon_init(video_adapter_t *adp) > { > + size_t hostlen; > > mtx_lock(&prison0.pr_mtx); > - messagelen = strlen(prison0.pr_hostname) + 3 + strlen(ostype) + 1 + > - strlen(osrelease); > - message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); > + for (;;) { > + hostlen = strlen(prison0.pr_hostname); > + mtx_unlock(&prison0.pr_mtx); > + > + messagelen = hostlen + 3 + strlen(ostype) + 1 + > + strlen(osrelease); > + message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); > + mtx_lock(&prison0.pr_mtx); > + if (hostlen < strlen(prison0.pr_hostname)) { > + free(message, M_DEVBUF); > + continue; > + } > + break; > + } > sprintf(message, "%s - %s %s", prison0.pr_hostname, ostype, osrelease); > mtx_unlock(&prison0.pr_mtx); > blanked = 0; > That works for me. Thank you.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4AA8AE8D.7080307>