4
0
Эх сурвалжийг харах

Fix for unclosed filehandle in pst3 on Solaris

Thanks to jwinkle01 for finding and patching the bug.

Closes Github issue #64:
https://github.com/nagios-plugins/nagios-plugins/issues/64
And tracker issue 0000658:
http://tracker.nagios.org/view.php?id=658
abrist 10 жил өмнө
parent
commit
1ba49583b8
1 өөрчлөгдсөн 3 нэмэгдсэн , 1 устгасан
  1. 3 1
      plugins-root/pst3.c

+ 3 - 1
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;