Skip to contentSkip to conversation

xenstore: NetBSD fix plus minor cleanup

PATCH New Christoph Egger 1 participant 1 message Oct 22, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenstore: NetBSD fix plus minor cleanup

Hi!

xs_domain_dev: return file used on NetBSD xs_daemon_path, xs_daemon_socket_ro: Use sizeof() consequently.

Signature · 12 lines
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy
tools/xenstore/xs_lib.c +5 -3
diff -r 7231d971f78c tools/xenstore/xs_lib.c
@@ -44,7 +44,7 @@ static const char *xs_daemon_path(void)
 	char *s = getenv("XENSTORED_PATH");
 	if (s)
 		return s;
-	if (snprintf(buf, PATH_MAX, "%s/socket",
+	if (snprintf(buf, sizeof(buf), "%s/socket",
 		     xs_daemon_rundir()) >= PATH_MAX)
 		return NULL;
 	return buf;
@@ -68,7 +68,7 @@ const char *xs_daemon_socket_ro(void)
 	const char *s = xs_daemon_path();
 	if (s == NULL)
 		return NULL;
-	if (snprintf(buf, PATH_MAX, "%s_ro", s) >= PATH_MAX)
+	if (snprintf(buf, sizeof(buf), "%s_ro", s) >= PATH_MAX)
 		return NULL;
 	return buf;
 }
@@ -79,8 +79,10 @@ const char *xs_domain_dev(void)
 	if (s)
 		return s;
 
-#ifdef __linux__
+#if defined(__linux__)
 	return "/proc/xen/xenbus";
+#elif defined(__NetBSD__)
+	return "/kern/xen/xenbus";
 #else
 	return "/dev/xen/xenbus";
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel