diff options
Diffstat (limited to 'util-linux/rtcwake.c')
-rw-r--r-- | util-linux/rtcwake.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c index c7d5a4c12..2b1ab1fca 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c | |||
@@ -45,7 +45,7 @@ static int may_wakeup(const char *rtcname) | |||
45 | return 0; | 45 | return 0; |
46 | 46 | ||
47 | /* wakeup events could be disabled or not supported */ | 47 | /* wakeup events could be disabled or not supported */ |
48 | return strcmp(buf, "enabled\n") == 0; | 48 | return strncmp(buf, "enabled\n", 8) == 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | static void setup_alarm(int fd, time_t *wakeup) | 51 | static void setup_alarm(int fd, time_t *wakeup) |
@@ -159,11 +159,11 @@ int rtcwake_main(int argc, char **argv) | |||
159 | /* the rtcname is relative to /dev */ | 159 | /* the rtcname is relative to /dev */ |
160 | xchdir("/dev"); | 160 | xchdir("/dev"); |
161 | 161 | ||
162 | if (strcmp(suspend, "on") != 0 && !may_wakeup(rtcname)) | ||
163 | bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); | ||
164 | |||
165 | /* this RTC must exist and (if we'll sleep) be wakeup-enabled */ | 162 | /* this RTC must exist and (if we'll sleep) be wakeup-enabled */ |
166 | fd = rtc_xopen(rtcname, O_RDONLY); | 163 | fd = rtc_xopen(&rtcname, O_RDONLY); |
164 | |||
165 | if (strcmp(suspend, "on") && !may_wakeup(rtcname)) | ||
166 | bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); | ||
167 | 167 | ||
168 | /* relative or absolute alarm time, normalized to time_t */ | 168 | /* relative or absolute alarm time, normalized to time_t */ |
169 | sys_time = time(0); | 169 | sys_time = time(0); |
@@ -184,7 +184,7 @@ int rtcwake_main(int argc, char **argv) | |||
184 | fflush(stdout); | 184 | fflush(stdout); |
185 | usleep(10 * 1000); | 185 | usleep(10 * 1000); |
186 | 186 | ||
187 | if (!strcmp(suspend, "on")) | 187 | if (strcmp(suspend, "on")) |
188 | suspend_system(suspend); | 188 | suspend_system(suspend); |
189 | else { | 189 | else { |
190 | /* "fake" suspend ... we'll do the delay ourselves */ | 190 | /* "fake" suspend ... we'll do the delay ourselves */ |