[evolution] Bug 785845 - pkill terminates also evolution-backup, not only evolution



commit ce183d89c32eb903c259d2101cc44bd2959888d2
Author: Milan Crha <mcrha redhat com>
Date:   Tue Aug 22 19:05:14 2017 +0200

    Bug 785845 - pkill terminates also evolution-backup, not only evolution

 CMakeLists.txt     |    5 +++++
 config.h.in        |    6 ++++++
 src/shell/killev.c |   19 ++++++++++++++-----
 3 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5fc68d..39eca7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -220,6 +220,11 @@ CHECK_FUNCTION_EXISTS(nl_langinfo HAVE_NL_LANGINFO)
 find_program(KILL_PROCESS_COMMAND killall)
 if(NOT KILL_PROCESS_COMMAND)
        find_program(KILL_PROCESS_COMMAND pkill)
+       set(KILL_PROCESS_COMMAND_ARGS "-f")
+       set(KILL_PROCESS_COMMAND_ARG_EXACT "-x")
+else(NOT KILL_PROCESS_COMMAND)
+       set(KILL_PROCESS_COMMAND_ARGS "")
+       set(KILL_PROCESS_COMMAND_ARG_EXACT "-e")
 endif(NOT KILL_PROCESS_COMMAND)
 
 if(NOT KILL_PROCESS_COMMAND)
diff --git a/config.h.in b/config.h.in
index 6d6e3f5..c39ccf8 100644
--- a/config.h.in
+++ b/config.h.in
@@ -30,6 +30,12 @@
 /* Command to kill processes by name */
 #cmakedefine KILL_PROCESS_COMMAND "@KILL_PROCESS_COMMAND@"
 
+/* Extra arguments to kill command */
+#cmakedefine KILL_PROCESS_COMMAND_ARGS "@KILL_PROCESS_COMMAND_ARGS@"
+
+/* An argument to kill command to match exact process */
+#cmakedefine KILL_PROCESS_COMMAND_ARG_EXACT "@KILL_PROCESS_COMMAND_ARG_EXACT@"
+
 /* Define to 1 if you have the `nl_langinfo' function. */
 #cmakedefine HAVE_NL_LANGINFO 1
 
diff --git a/src/shell/killev.c b/src/shell/killev.c
index 09fb05a..5409eb1 100644
--- a/src/shell/killev.c
+++ b/src/shell/killev.c
@@ -162,16 +162,25 @@ main (gint argc,
 
 kill:
 #ifdef KILL_PROCESS_COMMAND
-       if (system (KILL_PROCESS_COMMAND " -TERM evolution 2> /dev/null") == -1)
+#ifdef KILL_PROCESS_COMMAND_ARGS
+#define KILL_CMD KILL_PROCESS_COMMAND " " KILL_PROCESS_COMMAND_ARGS
+#else
+#define KILL_CMD KILL_PROCESS_COMMAND
+#endif
+#ifndef KILL_PROCESS_COMMAND_ARG_EXACT
+#define KILL_PROCESS_COMMAND_ARG_EXACT ""
+#endif
+       if (system (KILL_CMD " " KILL_PROCESS_COMMAND_ARG_EXACT " -TERM evolution 2> /dev/null") == -1)
                g_warning ("%s: Failed to execute: '%s'", G_STRFUNC, KILL_PROCESS_COMMAND);
-       if (system (KILL_PROCESS_COMMAND " -TERM evolution-alarm-notify 2> /dev/null") == -1)
+       if (system (KILL_CMD " -TERM evolution-alarm-notify 2> /dev/null") == -1)
                g_warning ("%s: Failed to execute: '%s'", G_STRFUNC, KILL_PROCESS_COMMAND);
-       if (system (KILL_PROCESS_COMMAND " -TERM evolution-source-registry 2> /dev/null") == -1)
+       if (system (KILL_CMD " -TERM evolution-source-registry 2> /dev/null") == -1)
                g_warning ("%s: Failed to execute: '%s'", G_STRFUNC, KILL_PROCESS_COMMAND);
-       if (system (KILL_PROCESS_COMMAND " -TERM evolution-addressbook-factory 2> /dev/null") == -1)
+       if (system (KILL_CMD " -TERM evolution-addressbook-factory 2> /dev/null") == -1)
                g_warning ("%s: Failed to execute: '%s'", G_STRFUNC, KILL_PROCESS_COMMAND);
-       if (system (KILL_PROCESS_COMMAND " -TERM evolution-calendar-factory 2> /dev/null") == -1)
+       if (system (KILL_CMD " -TERM evolution-calendar-factory 2> /dev/null") == -1)
                g_warning ("%s: Failed to execute: '%s'", G_STRFUNC, KILL_PROCESS_COMMAND);
+#undef KILL_CMD
 #else
        g_printerr ("No \"kill\" command available.\n");
 #endif


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