[PATCH 2/3] When in devel mode, do not catch tracebacks, we want the core file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- also make sure the terminal is in usable state when back in init
---
 loader/init.c   |   11 ++++++++++-
 loader/loader.c |   16 ++++++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/loader/init.c b/loader/init.c
index 6d6450e..d824390 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -491,7 +491,7 @@ int main(int argc, char **argv) {
         fatal_error(1);
     printf("done\n");
 
-    /* unless the user specifies that they want utf8 */
+    /* check for development mode early */
     int fdn;
     if ((fdn = open("/proc/cmdline", O_RDONLY, 0)) != -1) {
         int len = read(fdn, buf, sizeof(buf) - 1);
@@ -569,11 +569,13 @@ int main(int argc, char **argv) {
 
 #if !defined(__s390__) && !defined(__s390x__)
     static struct termios orig_cmode;
+    static int            orig_flags;
     struct termios cmode, mode;
     int cfd;
     
     cfd =  open("/dev/console", O_RDONLY);
     tcgetattr(cfd,&orig_cmode);
+    orig_flags = fcntl(cfd, F_GETFL);
     close(cfd);
 
     cmode = orig_cmode;
@@ -799,6 +801,13 @@ int main(int argc, char **argv) {
 
     if (!WIFEXITED(waitStatus) ||
         (WIFEXITED(waitStatus) && WEXITSTATUS(waitStatus))) {
+
+        /* Restore terminal */
+        cfd =  open("/dev/console", O_RDONLY);
+        tcsetattr(cfd, TCSANOW, &orig_cmode);
+        fcntl(cfd, F_SETFL, orig_flags);
+        close(cfd);
+
         shutdown_method = DELAYED_REBOOT;
         printf("install exited abnormally [%d/%d] ", WIFEXITED(waitStatus),
                                                      WEXITSTATUS(waitStatus));
diff --git a/loader/loader.c b/loader/loader.c
index 9320fec..0856332 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1791,6 +1791,9 @@ int restart_anaconda(struct loaderData_s *loaderData) {
 }
 
 static int anaconda_trace_init(void) {
+    int isDevelMode = 0;
+    gchar *buf;
+
 #ifdef USE_MTRACE
     setenv("MALLOC_TRACE","/malloc",1);
     mtrace();
@@ -1800,8 +1803,17 @@ static int anaconda_trace_init(void) {
      * is well before we might take a SEGV, so they'll go to tty8 */
     initializeTtys();
 
-    /* set up signal handler */
-    setupBacktrace();
+    /* check for development mode early */
+    if (g_file_get_contents("/proc/cmdline", &buf, NULL, NULL) == TRUE) {
+        if (strstr(buf, "devel")) {
+            isDevelMode = 1;
+        }
+        g_free(buf);
+    }
+
+    /* set up signal handler unless we want it to crash in devel mode */
+    if(!isDevelMode)
+        setupBacktrace();
 
     return 0;
 }
-- 
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux