krishnanadh / rpms / rasdaemon

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