[network-manager-applet: 1/5] applet/vpn-request: minor cleanups



commit dcb85fd94c397b9ef76ba41f07d8729071227397
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Fri Mar 27 10:50:33 2020 +0100

    applet/vpn-request: minor cleanups
    
    g_spawn_close_pid() is not necessary on Linux.
    
    It is not necessary to check the validity of pid and then send the
    signal; just send the signal.
    
    Remove unnecessary comments.

 src/applet-vpn-request.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/src/applet-vpn-request.c b/src/applet-vpn-request.c
index 91368f92..3dc6514b 100644
--- a/src/applet-vpn-request.c
+++ b/src/applet-vpn-request.c
@@ -683,9 +683,7 @@ ensure_killed (gpointer data)
 {
        pid_t pid = GPOINTER_TO_INT (data);
 
-       if (kill (pid, 0) == 0)
-               kill (pid, SIGKILL);
-       /* ensure the child is reaped */
+       kill (pid, SIGKILL);
        waitpid (pid, NULL, 0);
        return FALSE;
 }
@@ -709,12 +707,10 @@ request_data_free (RequestData *req_data)
                g_io_channel_unref (req_data->channel);
 
        if (req_data->pid) {
-               g_spawn_close_pid (req_data->pid);
                if (kill (req_data->pid, SIGTERM) == 0)
                        g_timeout_add_seconds (2, ensure_killed, GINT_TO_POINTER (req_data->pid));
                else {
                        kill (req_data->pid, SIGKILL);
-                       /* ensure the child is reaped */
                        waitpid (req_data->pid, NULL, 0);
                }
        }


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