[Pkg-owncloud-commits] [owncloud-client] 53/70: Enable core dumping if the env variable OWNCLOUD_CORE_DUMP is defined

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat May 17 20:01:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit f89bfce0685a56ddf412b3ec64f7ac1fb22ef1b7
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu May 15 11:01:21 2014 +0200

    Enable core dumping if the env variable OWNCLOUD_CORE_DUMP is defined
    
    Set OWNCLOUD_CORE_DUMP to anything to get a core dump in case of
    crashing.
---
 src/main.cpp | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/main.cpp b/src/main.cpp
index 285cf9c..ba1fa8e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,4 +1,5 @@
 /*
+ *
  * Copyright (C) by Duncan Mac-Vicar P. <duncan at kde.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -11,8 +12,15 @@
  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  * for more details.
  */
+#include <QtGlobal>
+
 #include <signal.h>
 
+#ifdef Q_OS_UNIX
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif
+
 #include "mirall/application.h"
 #include "mirall/theme.h"
 #include "mirall/utility.h"
@@ -51,6 +59,20 @@ int main(int argc, char **argv)
         return 0;
     }
 
+    // check a environment variable for core dumps
+#ifdef Q_OS_UNIX
+    if( !qgetenv("OWNCLOUD_CORE_DUMP").isEmpty() ) {
+        struct rlimit core_limit;
+        core_limit.rlim_cur = RLIM_INFINITY;
+        core_limit.rlim_max = RLIM_INFINITY;
+
+        if (setrlimit(RLIMIT_CORE, &core_limit) < 0) {
+            fprintf(stderr, "Unable to set core dump limit\n");
+        } else {
+            qDebug() << "Core dumps enabled";
+        }
+    }
+#endif
     // if handleStartup returns true, main()
     // needs to terminate here, e.g. because
     // the updater is triggered

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list