ia64/xen-unstable

changeset 6047:7931f14bd447

Fix xenbus_read() usage in shutdown handler.
author kaf24@firebug.cl.cam.ac.uk
date Sat Aug 06 09:54:57 2005 +0000 (2005-08-06)
parents e0146a206ea2
children 217fb2d1f364
files linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Sat Aug 06 09:52:01 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Sat Aug 06 09:54:57 2005 +0000
     1.3 @@ -248,21 +248,18 @@ static void shutdown_handler(struct xenb
     1.4      static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
     1.5  
     1.6      char *str;
     1.7 -    unsigned int len;
     1.8  
     1.9 -    str = (char *)xenbus_read("control", "shutdown", &len);
    1.10 -
    1.11 -    if (! len) {
    1.12 +    str = (char *)xenbus_read("control", "shutdown", NULL);
    1.13 +    if (IS_ERR(str))
    1.14          return;
    1.15 -    }
    1.16  
    1.17      xenbus_printf("control", "shutdown", "%i", SHUTDOWN_INVALID);
    1.18  
    1.19 -    if (strncmp(str, "poweroff", len) == 0) {
    1.20 +    if (strcmp(str, "poweroff") == 0) {
    1.21          shutting_down = SHUTDOWN_POWEROFF;
    1.22 -    } else if (strncmp(str, "reboot", len) == 0) {
    1.23 +    } else if (strcmp(str, "reboot") == 0) {
    1.24          shutting_down = SHUTDOWN_REBOOT;
    1.25 -    } else if (strncmp(str, "suspend", len) == 0) {
    1.26 +    } else if (strcmp(str, "suspend") == 0) {
    1.27          shutting_down = SHUTDOWN_SUSPEND;
    1.28      } else {
    1.29          printk("Ignoring shutdown request: %s\n", str);
    1.30 @@ -271,10 +268,8 @@ static void shutdown_handler(struct xenb
    1.31  
    1.32      kfree(str);
    1.33  
    1.34 -    if (shutting_down != SHUTDOWN_INVALID) {
    1.35 +    if (shutting_down != SHUTDOWN_INVALID)
    1.36          schedule_work(&shutdown_work);
    1.37 -    }
    1.38 -
    1.39  }
    1.40  
    1.41  #ifdef CONFIG_MAGIC_SYSRQ