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