aboutsummaryrefslogtreecommitdiff
path: root/util-linux/rtcwake.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-02-15 07:19:03 +0000
committerMike Frysinger <vapier@gentoo.org>2008-02-15 07:19:03 +0000
commit977bc6a1374ed468ec96e2202757be0c8b3592ed (patch)
tree00cd5d36831b37f1b941f38f87884d80f7e04409 /util-linux/rtcwake.c
parentea915363e747d4e42215016ceaef4b19e01baf55 (diff)
downloadbusybox-977bc6a1374ed468ec96e2202757be0c8b3592ed.tar.gz
we need to pass back the rtc device name that was actually used so that we can turn around and check its sysfs status
Diffstat (limited to 'util-linux/rtcwake.c')
-rw-r--r--util-linux/rtcwake.c12
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)
return 0;
/* wakeup events could be disabled or not supported */
- return strcmp(buf, "enabled\n") == 0;
+ return strncmp(buf, "enabled\n", 8) == 0;
}
static void setup_alarm(int fd, time_t *wakeup)
@@ -159,11 +159,11 @@ int rtcwake_main(int argc, char **argv)
/* the rtcname is relative to /dev */
xchdir("/dev");
- if (strcmp(suspend, "on") != 0 && !may_wakeup(rtcname))
- bb_error_msg_and_die("%s not enabled for wakeup events", rtcname);
-
/* this RTC must exist and (if we'll sleep) be wakeup-enabled */
- fd = rtc_xopen(rtcname, O_RDONLY);
+ fd = rtc_xopen(&rtcname, O_RDONLY);
+
+ if (strcmp(suspend, "on") && !may_wakeup(rtcname))
+ bb_error_msg_and_die("%s not enabled for wakeup events", rtcname);
/* relative or absolute alarm time, normalized to time_t */
sys_time = time(0);
@@ -184,7 +184,7 @@ int rtcwake_main(int argc, char **argv)
fflush(stdout);
usleep(10 * 1000);
- if (!strcmp(suspend, "on"))
+ if (strcmp(suspend, "on"))
suspend_system(suspend);
else {
/* "fake" suspend ... we'll do the delay ourselves */