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

[Xen-changelog] Fix xenbus_read() usage in shutdown handler.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 7931f14bd447465bfdf2a458f70ccac55edcad03
# Parent  e0146a206ea2b011054f543537cb74a572341ad5
Fix xenbus_read() usage in shutdown handler.

diff -r e0146a206ea2 -r 7931f14bd447 
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Sat Aug  6 09:52:01 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Sat Aug  6 09:54:57 2005
@@ -248,21 +248,18 @@
     static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
 
     char *str;
-    unsigned int len;
-
-    str = (char *)xenbus_read("control", "shutdown", &len);
-
-    if (! len) {
+
+    str = (char *)xenbus_read("control", "shutdown", NULL);
+    if (IS_ERR(str))
         return;
-    }
 
     xenbus_printf("control", "shutdown", "%i", SHUTDOWN_INVALID);
 
-    if (strncmp(str, "poweroff", len) == 0) {
+    if (strcmp(str, "poweroff") == 0) {
         shutting_down = SHUTDOWN_POWEROFF;
-    } else if (strncmp(str, "reboot", len) == 0) {
+    } else if (strcmp(str, "reboot") == 0) {
         shutting_down = SHUTDOWN_REBOOT;
-    } else if (strncmp(str, "suspend", len) == 0) {
+    } else if (strcmp(str, "suspend") == 0) {
         shutting_down = SHUTDOWN_SUSPEND;
     } else {
         printk("Ignoring shutdown request: %s\n", str);
@@ -271,10 +268,8 @@
 
     kfree(str);
 
-    if (shutting_down != SHUTDOWN_INVALID) {
+    if (shutting_down != SHUTDOWN_INVALID)
         schedule_work(&shutdown_work);
-    }
-
 }
 
 #ifdef CONFIG_MAGIC_SYSRQ

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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