[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 10/22] libxc: suspend: Fix suspend event channel locking



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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.