aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-08-17 08:26:58 +0000
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-08-17 08:26:58 +0000
commit72593432a519af4b6eed451fa4653992eb46755e (patch)
tree92209d6e967d21b8c47ae5513816f25114b965f0
parenta5479372a0e5c851a6bc344dde5949c60976f252 (diff)
downloadxen-72593432a519af4b6eed451fa4653992eb46755e.tar.gz
xen-72593432a519af4b6eed451fa4653992eb46755e.tar.bz2
xen-72593432a519af4b6eed451fa4653992eb46755e.zip
Avoid spurious "Ignoring shutdown request" messages, fix memory leak and simplif
y code. Also fix whitespace. Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
-rw-r--r--linux-2.6-xen-sparse/arch/xen/kernel/reboot.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
index d11eb8987a..d2e204d12d 100644
--- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
@@ -256,19 +256,23 @@ static void shutdown_handler(struct xenbus_watch *watch, const char *node)
char *str;
str = (char *)xenbus_read("control", "shutdown", NULL);
- /* Ignore read errors and recursive shutdown events. */
- if (IS_ERR(str) || !strcmp(str, __stringify(SHUTDOWN_INVALID)))
+ /* Ignore read errors. */
+ if (IS_ERR(str))
return;
+ if (strlen(str) == 0) {
+ kfree(str);
+ return;
+ }
- xenbus_printf("control", "shutdown", "%i", SHUTDOWN_INVALID);
+ xenbus_printf("control", "shutdown", "");
- if (strcmp(str, "poweroff") == 0) {
+ if (strcmp(str, "poweroff") == 0)
shutting_down = SHUTDOWN_POWEROFF;
- } else if (strcmp(str, "reboot") == 0) {
+ else if (strcmp(str, "reboot") == 0)
shutting_down = SHUTDOWN_REBOOT;
- } else if (strcmp(str, "suspend") == 0) {
+ else if (strcmp(str, "suspend") == 0)
shutting_down = SHUTDOWN_SUSPEND;
- } else {
+ else {
printk("Ignoring shutdown request: %s\n", str);
shutting_down = SHUTDOWN_INVALID;
}