9c49c9e
From 23dfbc560028bf7429196db1a3826f8b80c19d3e Mon Sep 17 00:00:00 2001
7c09728
From: Pavel Zhukov <pzhukov@redhat.com>
7c09728
Date: Thu, 21 Feb 2019 10:09:57 +0100
9c49c9e
Subject: [PATCH 01/26] change bug url
7c09728
Cc: pzhukov@redhat.com
7c09728
7c09728
---
7c09728
 omapip/errwarn.c | 47 ++++++++++++++++++++++++++++++++++++++++++-----
7c09728
 1 file changed, 42 insertions(+), 5 deletions(-)
7c09728
7c09728
diff --git a/omapip/errwarn.c b/omapip/errwarn.c
7c09728
index e30f8a0..09a3004 100644
7c09728
--- a/omapip/errwarn.c
7c09728
+++ b/omapip/errwarn.c
7c09728
@@ -48,6 +48,41 @@ void (*log_cleanup) (void);
1954e27
 static char mbuf [CVT_BUF_MAX + 1];
1954e27
 static char fbuf [CVT_BUF_MAX + 1];
1954e27
 
1954e27
+// get BUG_REPORT_URL from /etc/os-release
1954e27
+char * bug_report_url(void) {
1954e27
+    FILE * file = fopen("/etc/os-release", "r");
1954e27
+    size_t len;
1954e27
+    char * line = NULL;
1954e27
+    char * url = NULL;
1954e27
+    size_t url_len = 256;
1954e27
+
1954e27
+    url = (char *) malloc(url_len * sizeof(char));
1954e27
+    strcpy(url, "https://bugzilla.redhat.com/");
1954e27
+
1954e27
+    if (!file)
1954e27
+        return url;
1954e27
+
1954e27
+    while ((getline(&line, &len, file)) != -1) {
1954e27
+        if (strstr(line, "BUG_REPORT_URL") != NULL) {
1954e27
+            char * start = strchr(line, '=');
1954e27
+            char * rquotes = strrchr(line, '"');
1954e27
+
1954e27
+            if (rquotes != NULL) {
1954e27
+                *rquotes = '\0';
1954e27
+                strncpy(url, start+2, url_len);
1954e27
+            } else {
1954e27
+                strncpy(url, start+1, url_len);
1954e27
+            }
1954e27
+            url[url_len-1] = '\0';
1954e27
+            fclose(file);
1954e27
+            return url;
1954e27
+        }
1954e27
+    }
1954e27
+    fclose(file);
1954e27
+    return url;
1954e27
+}
1954e27
+
1954e27
+
1954e27
 /* Log an error message, then exit... */
1954e27
 
1954e27
 void log_fatal (const char * fmt, ... )
7c09728
@@ -74,11 +109,13 @@ void log_fatal (const char * fmt, ... )
e7bd38e
   }
db449ef
 
db449ef
   log_error ("%s", "");
e7bd38e
-  log_error ("If you think you have received this message due to a bug rather");
e7bd38e
-  log_error ("than a configuration issue please read the section on submitting");
e7bd38e
-  log_error ("bugs on either our web page at www.isc.org or in the README file");
e7bd38e
-  log_error ("before submitting a bug.  These pages explain the proper");
af708bb
-  log_error ("process and the information we find helpful for debugging.");
db449ef
+  log_error ("This version of ISC DHCP is based on the release available");
1954e27
+  log_error ("on ftp.isc.org. Features have been added and other changes");
db449ef
+  log_error ("have been made to the base software release in order to make");
db449ef
+  log_error ("it work better with this distribution.");
e7bd38e
+  log_error ("%s", "");
1954e27
+  log_error ("Please report issues with this software via: ");
1954e27
+  log_error ("%s", bug_report_url());
db449ef
   log_error ("%s", "");
db449ef
   log_error ("exiting.");
e7bd38e
 
7c09728
-- 
7c09728
2.14.5
7c09728