summaryrefslogtreecommitdiffstats
path: root/sys-utils/wdctl.c
diff options
context:
space:
mode:
authorSami Kerola2013-04-13 21:54:50 +0200
committerKarel Zak2013-04-26 13:26:06 +0200
commit3757e57f7b239db040604c402c26ec3a6295116f (patch)
treec7d7d7605c42e489669ec02556232c2de61de6d1 /sys-utils/wdctl.c
parentsfdisk: check writing to a file descriptor was successful (diff)
downloadkernel-qcow2-util-linux-3757e57f7b239db040604c402c26ec3a6295116f.tar.gz
kernel-qcow2-util-linux-3757e57f7b239db040604c402c26ec3a6295116f.tar.xz
kernel-qcow2-util-linux-3757e57f7b239db040604c402c26ec3a6295116f.zip
wdctl: check writing to a file descriptor was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/wdctl.c')
-rw-r--r--sys-utils/wdctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c
index 24ec770fb..af9a39338 100644
--- a/sys-utils/wdctl.c
+++ b/sys-utils/wdctl.c
@@ -330,7 +330,8 @@ static int set_watchdog(struct wdinfo *wd, int timeout)
warn(_("cannot set timeout for %s"), wd->device);
}
- close(fd);
+ if (close_fd(fd))
+ warn(_("write failed"));
sigprocmask(SIG_SETMASK, &oldsigs, NULL);
printf("Set timeout to %d seconds\n", timeout);
@@ -393,7 +394,8 @@ static int read_watchdog(struct wdinfo *wd)
* the machine might end up rebooting. */
}
- close(fd);
+ if (close_fd(fd))
+ warn(_("write failed"));
sigprocmask(SIG_SETMASK, &oldsigs, NULL);
return 0;