diff options
author | abrist <abrist@nagios.com> | 2015-07-28 15:20:38 -0400 |
---|---|---|
committer | Jan Wagner <waja@cyconet.org> | 2015-10-05 13:23:59 +0200 |
commit | d077d64e54c6162e410c4227fd75d090758594ea (patch) | |
tree | d4daa37dbe474a2f97dd9c0903bbe65674d57e2c /plugins-root | |
parent | dbd38bf7ec95c886b252d5ee0a66735f2f4a47c5 (diff) | |
download | monitoring-plugins-d077d64e54c6162e410c4227fd75d090758594ea.tar.gz |
Fix for unclosed filehandle in pst3 on Solaris
On Solaris, check_procs uses pst3 instead of /bin/ps (see
http://monitoring-plugins.org/doc/faq/ps-on-solaris.html for background). There's
a small bug in pst3 which causes it to NOT report some processes that are at
the end of the process table, at least on very busy systems (we noticed this
on a CoolThreads T5240 with load averages up to 90).
The bug is that a filehandle is not properly closed.
Thanks to jwinkle01 for finding and patching the bug.
(Closes #1203)
Diffstat (limited to 'plugins-root')
-rw-r--r-- | plugins-root/pst3.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins-root/pst3.c b/plugins-root/pst3.c index ee9d108d..c3589f0a 100644 --- a/plugins-root/pst3.c +++ b/plugins-root/pst3.c @@ -139,8 +139,10 @@ try_again: if((ps_fd = open(ps_name, O_RDONLY)) == -1) continue; - if((as_fd = open(as_name, O_RDONLY)) == -1) + if((as_fd = open(as_name, O_RDONLY)) == -1) { + close(ps_fd); continue; + } if(read(ps_fd, &psinfo, sizeof(psinfo)) != sizeof(psinfo)) { int err = errno; |