diff options
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/rtcwake.c | 15 | ||||
-rw-r--r-- | util-linux/script.c | 5 |
2 files changed, 4 insertions, 16 deletions
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c index 6df7334..515f812 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c @@ -30,7 +30,7 @@ static time_t rtc_time; -static int may_wakeup(const char *rtcname) +static bool may_wakeup(const char *rtcname) { ssize_t ret; char buf[128]; @@ -42,7 +42,7 @@ static int may_wakeup(const char *rtcname) snprintf(buf, sizeof(buf), SYS_RTC_PATH, rtcname); ret = open_read_close(buf, buf, sizeof(buf)); if (ret < 0) - return 0; + return false; /* wakeup events could be disabled or not supported */ return strncmp(buf, "enabled\n", 8) == 0; @@ -89,15 +89,6 @@ static void setup_alarm(int fd, time_t *wakeup) } } -static void suspend_system(const char *suspend) -{ - FILE *f = xfopen(SYS_POWER_PATH, "w"); - fprintf(f, "%s\n", suspend); - fflush(f); - /* this executes after wake from suspend */ - fclose(f); -} - #define RTCWAKE_OPT_AUTO 0x01 #define RTCWAKE_OPT_LOCAL 0x02 #define RTCWAKE_OPT_UTC 0x04 @@ -185,7 +176,7 @@ int rtcwake_main(int argc ATTRIBUTE_UNUSED, char **argv) usleep(10 * 1000); if (strcmp(suspend, "on")) - suspend_system(suspend); + xopen_xwrite_close(SYS_POWER_PATH, suspend); else { /* "fake" suspend ... we'll do the delay ourselves */ unsigned long data; diff --git a/util-linux/script.c b/util-linux/script.c index 63d3039..c188332 100644 --- a/util-linux/script.c +++ b/util-linux/script.c @@ -69,10 +69,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv) shell = DEFAULT_SHELL; } - pty = getpty(pty_line); - if (pty < 0) { - bb_perror_msg_and_die("can't get pty"); - } + pty = xgetpty(pty_line); /* get current stdin's tty params */ attr_ok = tcgetattr(0, &tt); |