[libgtop] Run server_command instead of hardcoded LIBGTOP_SERVER.



commit f04ce61b8056b79ce2dcf9fc6bb7c35ccfee10eb
Author: Benoit Dejean <bdejean gmail com>
Date:   Sat Feb 28 04:08:18 2015 +0100

    Run server_command instead of hardcoded LIBGTOP_SERVER.

 lib/init.c |    2 +-
 lib/open.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/lib/init.c b/lib/init.c
index 36014f6..6ad2ee4 100644
--- a/lib/init.c
+++ b/lib/init.c
@@ -141,7 +141,7 @@ _init_server (glibtop *server, const unsigned features)
 
                /* Open pipe to server. */
                server->method = GLIBTOP_METHOD_PIPE;
-
+               server->server_command = g_strdup(LIBGTOP_SERVER);
        } else {
 
                glibtop_error_r (server, "Unknown server method '%s'",
diff --git a/lib/open.c b/lib/open.c
index a3d4fdd..a63025f 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -95,7 +95,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
        case GLIBTOP_METHOD_PIPE:
 #ifdef LIBGTOP_ENABLE_DEBUG
                fprintf (stderr, "Opening pipe to server (%s).\n",
-                        LIBGTOP_SERVER);
+                        server->server_command);
 #endif
 
                if (pipe (server->input) || pipe (server->output))
@@ -110,9 +110,9 @@ glibtop_open_l (glibtop *server, const char *program_name,
                        close (server->input [0]); close (server->output [1]);
                        dup2 (server->input [1], 1);
                        dup2 (server->output [0], 0);
-                       execl (LIBGTOP_SERVER, "libgtop-server", NULL);
+                       execl (server->server_command, "libgtop-server", NULL);
                        glibtop_error_io_r (server, "execl (%s)",
-                                           LIBGTOP_SERVER);
+                                           server->server_command);
                        _exit (2);
                }
 


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