[X2Go-Commits] [x2goclient] 216/280: src/unixhelper.cpp: code cleanup.

git-admin at x2go.org git-admin at x2go.org
Wed Jan 18 12:25:59 CET 2017


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

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 6fe0ef07acd920fc79c99e6a32d1d67daa54bf67
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Aug 13 23:33:15 2016 +0200

    src/unixhelper.cpp: code cleanup.
---
 debian/changelog   |    1 +
 src/unixhelper.cpp |   14 +++++---------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a2f9e4f..6ab6c81 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -400,6 +400,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
       cleanup process doesn't kill itself before all other processes in the
       process group are killed.
     - src/pulsemanager.cpp: remove unused variables.
+    - src/unixhelper.cpp: code cleanup.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/unixhelper.cpp b/src/unixhelper.cpp
index 82e4374..d6b4993 100644
--- a/src/unixhelper.cpp
+++ b/src/unixhelper.cpp
@@ -31,7 +31,6 @@
 #include <vector>
 #include <cstdlib>
 #include <stdio.h>
-#include <string.h>
 
 /* For documentation please see unixhelper.h. */
 
@@ -60,8 +59,8 @@ namespace unixhelper {
       }
       /* Error. */
       else if (-1 == tmp_pid) {
-        perror ("WARNING: unable to fork off another process to kill original process group");
-        std::cerr << "Proceeding with normal operation, but  process might kill itself before tree vanishes." << std::endl;
+        std::perror ("WARNING: unable to fork off another process to kill original process group");
+        std::cerr << "Proceeding with normal operation, but process might kill itself before tree vanishes." << std::endl;
 
         real_kill_pgroup (pgid_to_kill);
       }
@@ -72,7 +71,7 @@ namespace unixhelper {
          * spawn a bunch of new processes due to subsequent calls
          * to kill_pgroup () from unix_cleanup ().
          */
-        exit (EXIT_SUCCESS);
+        std::exit (EXIT_SUCCESS);
       }
     }
   }
@@ -96,13 +95,10 @@ namespace unixhelper {
      * Let's handle errors and exit, if necessary.
      */
     if (0 != kill_ret) {
-      char err_str[512] = { };
-      snprintf (err_str, 512, "WARNING: failed to kill process group '%d'", pgid);
-
-      perror (err_str);
+      std::cerr << "WARNING: failed to kill process group '" << pgid << "': " << std::strerror (err_str) << std::endl;
     }
 
-    exit (EXIT_SUCCESS);
+    std::exit (EXIT_SUCCESS);
   }
 
   int unix_cleanup (const pid_t parent) {

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list