Fix xenbus_read() usage in shutdown handler.

This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2005-08-06 09:54:57 +00:00
1 parent b07bb957ff
commit ce5f74eea0
1 file changed
+6 -11
+6 -11
View File
@@ -248,21 +248,18 @@ static void shutdown_handler(struct xenbus_watch *watch, const char *node)
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 @@ static void shutdown_handler(struct xenbus_watch *watch, const char *node)
kfree(str);
if (shutting_down != SHUTDOWN_INVALID) {
if (shutting_down != SHUTDOWN_INVALID)
schedule_work(&shutdown_work);
}
}
#ifdef CONFIG_MAGIC_SYSRQ
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.