From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] xenconsole: Ensure exclusive access to console using locks Date: Fri, 24 Jul 2015 14:42:40 +0100 Message-ID: <1437745360.24746.101.camel@citrix.com> References: <1437738262.24746.79.camel@citrix.com> <1437742310-14193-1-git-send-email-martin@lucina.net> <21938.15968.711376.627272@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZIdGh-0001Ps-OB for xen-devel@lists.xenproject.org; Fri, 24 Jul 2015 13:44:07 +0000 In-Reply-To: <21938.15968.711376.627272@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson , Martin Lucina Cc: xen-devel@lists.xenproject.org, Wei Liu , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, 2015-07-24 at 14:32 +0100, Ian Jackson wrote: > > > > +static void console_lock(int domid) > > +{ > > + lockfile = malloc(PATH_MAX); > > + if (lockfile == NULL) > > + err(ENOMEM, "malloc"); > > + snprintf(lockfile, PATH_MAX - 1, "%s/xenconsole.%d", > > XEN_LOCK_DIR, domid); > > Why not use asprintf ? I thought that, but it isn't generally available (not on one of the BSDs, I think) e.g. libxl provides its own (libxl_osdep.c) if configure says it isn't available. It's a shame that isn't more generally useful throughout the tree. But IMHO a static buffer should be fine for this use case. Ian.