From: Sami Kerola Date: Sat, 13 Apr 2013 19:54:50 +0000 (+0100) Subject: wdctl: check writing to a file descriptor was successful X-Git-Tag: v2.24-rc1~590 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3757e57f7b239db040604c402c26ec3a6295116f;p=thirdparty%2Futil-linux.git wdctl: check writing to a file descriptor was successful Signed-off-by: Sami Kerola --- diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c index 24ec770fb0..af9a393387 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;