diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2011-11-02 22:07:02 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-11-02 22:07:02 +0100 |
commit | b36c89351659e1ee3367b32715cf12ef80682b12 (patch) | |
tree | 45d1dafb4c517f6710b5f1955be52ef10be29b9f /msg.c | |
parent | mdadm: Rearrange option parsing for KillSubarray and UpdateSubarray (diff) | |
download | mdadm-b36c89351659e1ee3367b32715cf12ef80682b12.tar.xz mdadm-b36c89351659e1ee3367b32715cf12ef80682b12.zip |
ping_monitor(): check file descriptor is valid before using and closing it
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'msg.c')
-rw-r--r-- | msg.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -207,9 +207,14 @@ int fping_monitor(int sfd) int ping_monitor(char *devname) { int sfd = connect_monitor(devname); - int err = fping_monitor(sfd); + int err; + + if (sfd >= 0) { + err = fping_monitor(sfd); + close(sfd); + } else + err = -1; - close(sfd); return err; } |