krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0031-Correct-ABRT-report-data.patch

ac32bf
From d7453479e96693ebb5e17b285adf915b67095aad Mon Sep 17 00:00:00 2001
ac32bf
From: Jakub Filak <jfilak@redhat.com>
ac32bf
Date: Wed, 2 Apr 2014 15:03:44 +0200
ac32bf
Subject: [PATCH 31/32] Correct ABRT report data
ac32bf
ac32bf
Remove '\0' byte from 'PUT' message because this was superfluous.
ac32bf
ac32bf
Replaced 'BASENAME' item with 'TYPE' item because the first one is no
ac32bf
longer supported by abrtd and the second one is required. Basically the
ac32bf
later is a substitute for the first one.
ac32bf
ac32bf
Removed the closing message which is not supported by abrtd. abrtd
ac32bf
considers that message as a part of the problem report.
ac32bf
ac32bf
Removed a superfluous space from 'Backtrace'.
ac32bf
ac32bf
Signed-off-by: Jakub Filak <jfilak@redhat.com>
ac32bf
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
ac32bf
---
ac32bf
 ras-report.c |   41 ++++-------------------------------------
ac32bf
 1 files changed, 4 insertions(+), 37 deletions(-)
ac32bf
ac32bf
diff --git a/ras-report.c b/ras-report.c
ac32bf
index d3e4a79..0a05732 100644
ac32bf
--- a/ras-report.c
ac32bf
+++ b/ras-report.c
ac32bf
@@ -51,8 +51,8 @@ static int commit_report_basic(int sockfd){
ac32bf
 	 * ABRT server protocol
ac32bf
 	 */
ac32bf
 	sprintf(buf, "PUT / HTTP/1.1\r\n\r\n");
ac32bf
-	rc = write(sockfd, buf, strlen(buf) + 1);
ac32bf
-	if(rc < strlen(buf) + 1){
ac32bf
+	rc = write(sockfd, buf, strlen(buf));
ac32bf
+	if(rc < strlen(buf)){
ac32bf
 		return -1;
ac32bf
 	}
ac32bf
 
ac32bf
@@ -68,7 +68,7 @@ static int commit_report_basic(int sockfd){
ac32bf
 		return -1;
ac32bf
 	}
ac32bf
 
ac32bf
-	sprintf(buf, "BASENAME=%s", "rasdaemon");
ac32bf
+	sprintf(buf, "TYPE=%s", "ras");
ac32bf
 	rc = write(sockfd, buf, strlen(buf) + 1);
ac32bf
 	if(rc < strlen(buf) + 1){
ac32bf
 		return -1;
ac32bf
@@ -77,31 +77,13 @@ static int commit_report_basic(int sockfd){
ac32bf
 	return 0;
ac32bf
 }
ac32bf
 
ac32bf
-/*
ac32bf
- *  add "DONE" string to finish message.
ac32bf
- */
ac32bf
-static int commit_report_done(int sockfd){
ac32bf
-	int rc = -1;
ac32bf
-
ac32bf
-	if(sockfd < 0){
ac32bf
-		return -1;
ac32bf
-	}
ac32bf
-
ac32bf
-	rc = write(sockfd, "DONE\0", strlen("DONE\0"));
ac32bf
-	if(rc < strlen("DONE\0")){
ac32bf
-		return -1;
ac32bf
-	}
ac32bf
-
ac32bf
-	return 0;
ac32bf
-}
ac32bf
-
ac32bf
 static int set_mc_event_backtrace(char *buf, struct ras_mc_event *ev){
ac32bf
 	char bt_buf[MAX_BACKTRACE_SIZE];
ac32bf
 
ac32bf
 	if(!buf || !ev)
ac32bf
 		return -1;
ac32bf
 
ac32bf
-	sprintf(bt_buf, "BACKTRACE= "	\
ac32bf
+	sprintf(bt_buf, "BACKTRACE="	\
ac32bf
 						"timestamp=%s\n"	\
ac32bf
 						"error_count=%d\n"	\
ac32bf
 						"error_type=%s\n"	\
ac32bf
@@ -298,11 +280,6 @@ int ras_report_mc_event(struct ras_events *ras, struct ras_mc_event *ev){
ac32bf
 		goto mc_fail;
ac32bf
 	}
ac32bf
 
ac32bf
-	rc = commit_report_done(sockfd);
ac32bf
-	if(rc < 0){
ac32bf
-		goto mc_fail;
ac32bf
-	}
ac32bf
-
ac32bf
 	done = 1;
ac32bf
 
ac32bf
 mc_fail:
ac32bf
@@ -353,11 +330,6 @@ int ras_report_aer_event(struct ras_events *ras, struct ras_aer_event *ev){
ac32bf
 		goto aer_fail;
ac32bf
 	}
ac32bf
 
ac32bf
-	rc = commit_report_done(sockfd);
ac32bf
-	if(rc < 0){
ac32bf
-		goto aer_fail;
ac32bf
-	}
ac32bf
-
ac32bf
 	done = 1;
ac32bf
 
ac32bf
 aer_fail:
ac32bf
@@ -408,11 +380,6 @@ int ras_report_mce_event(struct ras_events *ras, struct mce_event *ev){
ac32bf
 		goto mce_fail;
ac32bf
 	}
ac32bf
 
ac32bf
-	rc = commit_report_done(sockfd);
ac32bf
-	if(rc < 0){
ac32bf
-		goto mce_fail;
ac32bf
-	}
ac32bf
-
ac32bf
 	done = 1;
ac32bf
 
ac32bf
 mce_fail:
ac32bf
-- 
ac32bf
1.7.1
ac32bf