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

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



- 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 bf96653..249c64b 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1755,6 +1755,9 @@ void loaderUsrXHandler(int signum) {
 }
 
 static int anaconda_trace_init(void) {
+    int isDevelMode = 0;
+    gchar *buf;
+
 #ifdef USE_MTRACE
     setenv("MALLOC_TRACE","/malloc",1);
     mtrace();
@@ -1764,8 +1767,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


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