]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/porting.cpp
merged fix to readlink ignored return value warning
[dragonfireclient.git] / src / porting.cpp
index 50605587dc1950c5315811d5320cb6480225fa37..7c7ce48eae3a62265bab4856e867334daeff3f95 100644 (file)
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "porting.h"
 #include "config.h"
+#include "debug.h"
 
 namespace porting
 {
@@ -47,8 +48,13 @@ void sigint_handler(int sig)
 {
        if(g_killed == false)
        {
-               dstream<<DTIME<<"sigint_handler(): "
+               dstream<<DTIME<<"INFO: sigint_handler(): "
                                <<"Ctrl-C pressed, shutting down."<<std::endl;
+               
+               dstream<<DTIME<<"INFO: sigint_handler(): "
+                               <<"Printing debug stacks"<<std::endl;
+               debug_stacks_print();
+
                g_killed = true;
        }
        else
@@ -130,7 +136,7 @@ void initializePaths()
        char buf[BUFSIZ];
        memset(buf, 0, BUFSIZ);
        // Get path to executable
-       readlink("/proc/self/exe", buf, BUFSIZ-1);
+       assert(readlink("/proc/self/exe", buf, BUFSIZ-1) != -1);
        
        pathRemoveFile(buf, '/');
 
@@ -194,7 +200,7 @@ void initializePaths()
        char buf[BUFSIZ];
        memset(buf, 0, BUFSIZ);
        // Get path to executable
-       readlink("/proc/self/exe", buf, BUFSIZ-1);
+       assert(readlink("/proc/self/exe", buf, BUFSIZ-1) != -1);
        
        pathRemoveFile(buf, '/');