diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2007-05-17 01:11:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-17 08:23:05 -0400 |
commit | 8d98a690f58e0d6ecf424b7ca84488475cf87bd9 (patch) | |
tree | 09adca50773f465b75fc04682377bfaa40c72876 /kernel/power/main.c | |
parent | 7925409e202a41176b729671eab6e610a54153cd (diff) |
swsusp: fix sysfs interface
The sysfs files /sys/power/disk and /sys/power/state do not work as
documented, since they allow the user to write only a few initial
characters of the input string to trigger the option (eg. 'echo pl >
/sys/power/disk' activates the platform mode of hibernation). Fix it.
Special thanks to Peter Moulder <Peter.Moulder@infotech.monash.edu.au> for
pointing out the problem.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r-- | kernel/power/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index b98b80ccf437..8812985f3029 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -290,13 +290,13 @@ static ssize_t state_store(struct kset *kset, const char *buf, size_t n) | |||
290 | len = p ? p - buf : n; | 290 | len = p ? p - buf : n; |
291 | 291 | ||
292 | /* First, check if we are requested to hibernate */ | 292 | /* First, check if we are requested to hibernate */ |
293 | if (!strncmp(buf, "disk", len)) { | 293 | if (len == 4 && !strncmp(buf, "disk", len)) { |
294 | error = hibernate(); | 294 | error = hibernate(); |
295 | return error ? error : n; | 295 | return error ? error : n; |
296 | } | 296 | } |
297 | 297 | ||
298 | for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) { | 298 | for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) { |
299 | if (*s && !strncmp(buf, *s, len)) | 299 | if (*s && len == strlen(*s) && !strncmp(buf, *s, len)) |
300 | break; | 300 | break; |
301 | } | 301 | } |
302 | if (state < PM_SUSPEND_MAX && *s) | 302 | if (state < PM_SUSPEND_MAX && *s) |