]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wdctl: check writing to a file descriptor was successful
authorSami Kerola <kerolasa@iki.fi>
Sat, 13 Apr 2013 19:54:50 +0000 (20:54 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 26 Apr 2013 11:26:06 +0000 (13:26 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/wdctl.c

index 24ec770fb038b0e959310e2dd43d75976db95990..af9a3933871dba31ac0f5d5dc5a392145d9c78d6 100644 (file)
@@ -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;