philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone
324fcf
diff -up dhcp-4.3.5/omapip/errwarn.c.errwarn dhcp-4.3.5/omapip/errwarn.c
324fcf
--- dhcp-4.3.5/omapip/errwarn.c.errwarn	2016-09-27 21:16:50.000000000 +0200
324fcf
+++ dhcp-4.3.5/omapip/errwarn.c	2016-11-29 19:44:03.515031147 +0100
324fcf
@@ -49,6 +49,41 @@ void (*log_cleanup) (void);
324fcf
 static char mbuf [CVT_BUF_MAX + 1];
324fcf
 static char fbuf [CVT_BUF_MAX + 1];
324fcf
 
324fcf
+// get BUG_REPORT_URL from /etc/os-release
324fcf
+char * bug_report_url(void) {
324fcf
+    FILE * file = fopen("/etc/os-release", "r");
324fcf
+    size_t len;
324fcf
+    char * line = NULL;
324fcf
+    char * url = NULL;
324fcf
+    size_t url_len = 256;
324fcf
+
324fcf
+    url = (char *) malloc(url_len * sizeof(char));
324fcf
+    strcpy(url, "https://bugzilla.redhat.com/");
324fcf
+
324fcf
+    if (!file)
324fcf
+        return url;
324fcf
+
324fcf
+    while ((getline(&line, &len, file)) != -1) {
324fcf
+        if (strstr(line, "BUG_REPORT_URL") != NULL) {
324fcf
+            char * start = strchr(line, '=');
324fcf
+            char * rquotes = strrchr(line, '"');
324fcf
+
324fcf
+            if (rquotes != NULL) {
324fcf
+                *rquotes = '\0';
324fcf
+                strncpy(url, start+2, url_len);
324fcf
+            } else {
324fcf
+                strncpy(url, start+1, url_len);
324fcf
+            }
324fcf
+            url[url_len-1] = '\0';
324fcf
+            fclose(file);
324fcf
+            return url;
324fcf
+        }
324fcf
+    }
324fcf
+    fclose(file);
324fcf
+    return url;
324fcf
+}
324fcf
+
324fcf
+
324fcf
 /* Log an error message, then exit... */
324fcf
 
324fcf
 void log_fatal (const char * fmt, ... )
324fcf
@@ -75,11 +110,13 @@ void log_fatal (const char * fmt, ... )
324fcf
   }
324fcf
 
324fcf
   log_error ("%s", "");
324fcf
-  log_error ("If you think you have received this message due to a bug rather");
324fcf
-  log_error ("than a configuration issue please read the section on submitting");
324fcf
-  log_error ("bugs on either our web page at www.isc.org or in the README file");
324fcf
-  log_error ("before submitting a bug.  These pages explain the proper");
324fcf
-  log_error ("process and the information we find helpful for debugging.");
324fcf
+  log_error ("This version of ISC DHCP is based on the release available");
324fcf
+  log_error ("on ftp.isc.org. Features have been added and other changes");
324fcf
+  log_error ("have been made to the base software release in order to make");
324fcf
+  log_error ("it work better with this distribution.");
324fcf
+  log_error ("%s", "");
324fcf
+  log_error ("Please report issues with this software via: ");
324fcf
+  log_error ("%s", bug_report_url());
324fcf
   log_error ("%s", "");
324fcf
   log_error ("exiting.");
324fcf