7b5b3d
commit 899fcc2cf21c86b5462c8f4441cd9c92b3d75f7d
7b5b3d
Author: Aristeu Rozanski <arozansk@redhat.com>
7b5b3d
Date:   Thu Jan 19 08:45:57 2023 -0500
7b5b3d
7b5b3d
    rasdaemon: ras-report: fix possible but unlikely file descriptor leak
7b5b3d
    
7b5b3d
    Found with covscan.
7b5b3d
    
7b5b3d
    Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
7b5b3d
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7b5b3d
7b5b3d
---
7b5b3d
 ras-report.c |   12 ++++++------
7b5b3d
 1 file changed, 6 insertions(+), 6 deletions(-)
7b5b3d
7b5b3d
--- rasdaemon-0.6.1.orig/ras-report.c	2023-01-23 11:36:20.972368760 -0500
7b5b3d
+++ rasdaemon-0.6.1/ras-report.c	2023-01-23 11:36:23.236343267 -0500
7b5b3d
@@ -374,7 +374,7 @@ if(rc < 0){
7b5b3d
 
7b5b3d
 mc_fail:
7b5b3d
 
7b5b3d
-	if(sockfd > 0){
7b5b3d
+	if(sockfd >= 0){
7b5b3d
 		close(sockfd);
7b5b3d
 	}
7b5b3d
 
7b5b3d
@@ -424,7 +424,7 @@ if(rc < 0){
7b5b3d
 
7b5b3d
 aer_fail:
7b5b3d
 
7b5b3d
-	if(sockfd > 0){
7b5b3d
+	if(sockfd >= 0){
7b5b3d
 		close(sockfd);
7b5b3d
 	}
7b5b3d
 
7b5b3d
@@ -473,7 +473,7 @@ rc = 0;
7b5b3d
 
7b5b3d
 non_standard_fail:
7b5b3d
 
7b5b3d
-	if(sockfd > 0){
7b5b3d
+	if(sockfd >= 0){
7b5b3d
 		close(sockfd);
7b5b3d
 	}
7b5b3d
 
7b5b3d
@@ -518,7 +518,7 @@ rc = 0;
7b5b3d
 
7b5b3d
 arm_fail:
7b5b3d
 
7b5b3d
-	if(sockfd > 0){
7b5b3d
+	if(sockfd >= 0){
7b5b3d
 		close(sockfd);
7b5b3d
 	}
7b5b3d
 
7b5b3d
@@ -564,7 +564,7 @@ if(rc < 0){
7b5b3d
 
7b5b3d
 mce_fail:
7b5b3d
 
7b5b3d
-	if(sockfd > 0){
7b5b3d
+	if(sockfd >= 0){
7b5b3d
 		close(sockfd);
7b5b3d
 	}
7b5b3d
 
7b5b3d
@@ -609,7 +609,7 @@ if (rc < 0)
7b5b3d
 	done = 1;
7b5b3d
 
7b5b3d
 mf_fail:
7b5b3d
-	if (sockfd > 0)
7b5b3d
+	if (sockfd >= 0)
7b5b3d
 		close(sockfd);
7b5b3d
 
7b5b3d
 	if (done)