ia64/xen-unstable

changeset 16188:368f563f2fd0

A few small fixes for xenstored:
- Proper sizeof parameter to snprintf
- Return proper xs_domain_dev for netbsd.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
author Keir Fraser <keir@xensource.com>
date Mon Oct 22 14:22:39 2007 +0100 (2007-10-22)
parents dc2ff26bbdf6
children 24c2745f939f
files tools/xenstore/xs_lib.c
line diff
     1.1 --- a/tools/xenstore/xs_lib.c	Mon Oct 22 14:21:13 2007 +0100
     1.2 +++ b/tools/xenstore/xs_lib.c	Mon Oct 22 14:22:39 2007 +0100
     1.3 @@ -44,7 +44,7 @@ static const char *xs_daemon_path(void)
     1.4  	char *s = getenv("XENSTORED_PATH");
     1.5  	if (s)
     1.6  		return s;
     1.7 -	if (snprintf(buf, PATH_MAX, "%s/socket",
     1.8 +	if (snprintf(buf, sizeof(buf), "%s/socket",
     1.9  		     xs_daemon_rundir()) >= PATH_MAX)
    1.10  		return NULL;
    1.11  	return buf;
    1.12 @@ -68,7 +68,7 @@ const char *xs_daemon_socket_ro(void)
    1.13  	const char *s = xs_daemon_path();
    1.14  	if (s == NULL)
    1.15  		return NULL;
    1.16 -	if (snprintf(buf, PATH_MAX, "%s_ro", s) >= PATH_MAX)
    1.17 +	if (snprintf(buf, sizeof(buf), "%s_ro", s) >= PATH_MAX)
    1.18  		return NULL;
    1.19  	return buf;
    1.20  }
    1.21 @@ -79,8 +79,10 @@ const char *xs_domain_dev(void)
    1.22  	if (s)
    1.23  		return s;
    1.24  
    1.25 -#ifdef __linux__
    1.26 +#if defined(__linux__)
    1.27  	return "/proc/xen/xenbus";
    1.28 +#elif defined(__NetBSD__)
    1.29 +	return "/kern/xen/xenbus";
    1.30  #else
    1.31  	return "/dev/xen/xenbus";
    1.32  #endif