From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: Re: [PATCH 10/22] libxc: suspend: Fix suspend event channel locking Date: Tue, 18 Mar 2014 09:44:27 +0100 Message-ID: <20140318084426.GA16621@aepfle.de> References: <1395063006-6671-1-git-send-email-ian.jackson@eu.citrix.com> <1395063006-6671-11-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1395063006-6671-11-git-send-email-ian.jackson@eu.citrix.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 Cc: Shriram Rajagopalan , Lai Jiangshan , xen-devel@lists.xensource.com, Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Mon, Mar 17, Ian Jackson wrote: > +#define SUSPEND_FILE_BUFLEN (sizeof(SUSPEND_LOCK_FILE) + 10) > + > +static void get_suspend_file(char buf[SUSPEND_FILE_BUFLEN], int domid) > { > - int fd, rc; > - mode_t mask; > - char buf[128]; > - char suspend_file[256]; > - > - snprintf(suspend_file, sizeof(suspend_file), "%s_%d_lock.d", > - SUSPEND_LOCK_FILE, domid); > - mask = umask(022); > - fd = open(suspend_file, O_CREAT | O_EXCL | O_RDWR, 0666); > - if (fd < 0) > - { > - ERROR("Can't create lock file for suspend event channel %s\n", > - suspend_file); > - return -EINVAL; > + snprintf(buf, sizeof(buf), SUSPEND_LOCK_FILE, domid); > +} This fails with newer gcc, such as gcc-4.8: xc_suspend.c: In function 'get_suspend_file': xc_suspend.c:39:25: error: argument to 'sizeof' in 'snprintf' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] snprintf(buf, sizeof(buf), SUSPEND_LOCK_FILE, domid); ^ cc1: all warnings being treated as errors Olaf