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 6df7334fe..515f812b3 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | static time_t rtc_time; | 31 | static time_t rtc_time; |
32 | 32 | ||
33 | static int may_wakeup(const char *rtcname) | 33 | static bool may_wakeup(const char *rtcname) |
34 | { | 34 | { |
35 | ssize_t ret; | 35 | ssize_t ret; |
36 | char buf[128]; | 36 | char buf[128]; |
@@ -42,7 +42,7 @@ static int may_wakeup(const char *rtcname) | |||
42 | snprintf(buf, sizeof(buf), SYS_RTC_PATH, rtcname); | 42 | snprintf(buf, sizeof(buf), SYS_RTC_PATH, rtcname); |
43 | ret = open_read_close(buf, buf, sizeof(buf)); | 43 | ret = open_read_close(buf, buf, sizeof(buf)); |
44 | if (ret < 0) | 44 | if (ret < 0) |
45 | return 0; | 45 | return false; |
46 | 46 | ||
47 | /* wakeup events could be disabled or not supported */ | 47 | /* wakeup events could be disabled or not supported */ |
48 | return strncmp(buf, "enabled\n", 8) == 0; | 48 | return strncmp(buf, "enabled\n", 8) == 0; |
@@ -89,15 +89,6 @@ static void setup_alarm(int fd, time_t *wakeup) | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | static void suspend_system(const char *suspend) | ||
93 | { | ||
94 | FILE *f = xfopen(SYS_POWER_PATH, "w"); | ||
95 | fprintf(f, "%s\n", suspend); | ||
96 | fflush(f); | ||
97 | /* this executes after wake from suspend */ | ||
98 | fclose(f); | ||
99 | } | ||
100 | |||
101 | #define RTCWAKE_OPT_AUTO 0x01 | 92 | #define RTCWAKE_OPT_AUTO 0x01 |
102 | #define RTCWAKE_OPT_LOCAL 0x02 | 93 | #define RTCWAKE_OPT_LOCAL 0x02 |
103 | #define RTCWAKE_OPT_UTC 0x04 | 94 | #define RTCWAKE_OPT_UTC 0x04 |
@@ -185,7 +176,7 @@ int rtcwake_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
185 | usleep(10 * 1000); | 176 | usleep(10 * 1000); |
186 | 177 | ||
187 | if (strcmp(suspend, "on")) | 178 | if (strcmp(suspend, "on")) |
188 | suspend_system(suspend); | 179 | xopen_xwrite_close(SYS_POWER_PATH, suspend); |
189 | else { | 180 | else { |
190 | /* "fake" suspend ... we'll do the delay ourselves */ | 181 | /* "fake" suspend ... we'll do the delay ourselves */ |
191 | unsigned long data; | 182 | unsigned long data; |
diff --git a/util-linux/script.c b/util-linux/script.c index 63d3039d3..c1883328f 100644 --- a/util-linux/script.c +++ b/util-linux/script.c | |||
@@ -69,10 +69,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
69 | shell = DEFAULT_SHELL; | 69 | shell = DEFAULT_SHELL; |
70 | } | 70 | } |
71 | 71 | ||
72 | pty = getpty(pty_line); | 72 | pty = xgetpty(pty_line); |
73 | if (pty < 0) { | ||
74 | bb_perror_msg_and_die("can't get pty"); | ||
75 | } | ||
76 | 73 | ||
77 | /* get current stdin's tty params */ | 74 | /* get current stdin's tty params */ |
78 | attr_ok = tcgetattr(0, &tt); | 75 | attr_ok = tcgetattr(0, &tt); |