summaryrefslogtreecommitdiffstats
path: root/sys-utils/rtcwake.c
diff options
context:
space:
mode:
authorSami Kerola2012-04-04 19:49:40 +0200
committerSami Kerola2012-04-04 19:49:40 +0200
commitefb8854f4cfa335f3ad72d79a84589110c2a8e87 (patch)
tree83d1c6e33bb7afacb40bc81772d390d009fd70ac /sys-utils/rtcwake.c
parentterm-utils: verify writing to streams was successful (diff)
downloadkernel-qcow2-util-linux-efb8854f4cfa335f3ad72d79a84589110c2a8e87.tar.gz
kernel-qcow2-util-linux-efb8854f4cfa335f3ad72d79a84589110c2a8e87.tar.xz
kernel-qcow2-util-linux-efb8854f4cfa335f3ad72d79a84589110c2a8e87.zip
sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/rtcwake.c')
-rw-r--r--sys-utils/rtcwake.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index c18e5e2fc..4ae2cef29 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -41,6 +41,7 @@
#include "usleep.h"
#include "strutils.h"
#include "c.h"
+#include "closestream.h"
/* constants from legacy PC/AT hardware */
#define RTC_PF 0x40
@@ -285,7 +286,8 @@ static void suspend_system(const char *suspend)
}
/* this executes after wake from suspend */
- fclose(f);
+ if (close_stream(f))
+ errx(EXIT_FAILURE, _("write error"));
}
@@ -394,6 +396,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
while ((t = getopt_long(argc, argv, "ahd:lm:ns:t:uVv",
long_options, NULL)) != EOF) {