Run server_command instead of hardcoded LIBGTOP_SERVER.

This commit is contained in:
Benoit Dejean
2015-02-28 04:08:18 +01:00
committed by Robert Roth
parent c7f7e5a1c6
commit f04ce61b80
2 changed files with 4 additions and 4 deletions

View File

@@ -141,7 +141,7 @@ _init_server (glibtop *server, const unsigned features)
/* Open pipe to server. */ /* Open pipe to server. */
server->method = GLIBTOP_METHOD_PIPE; server->method = GLIBTOP_METHOD_PIPE;
server->server_command = g_strdup(LIBGTOP_SERVER);
} else { } else {
glibtop_error_r (server, "Unknown server method '%s'", glibtop_error_r (server, "Unknown server method '%s'",

View File

@@ -95,7 +95,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
case GLIBTOP_METHOD_PIPE: case GLIBTOP_METHOD_PIPE:
#ifdef LIBGTOP_ENABLE_DEBUG #ifdef LIBGTOP_ENABLE_DEBUG
fprintf (stderr, "Opening pipe to server (%s).\n", fprintf (stderr, "Opening pipe to server (%s).\n",
LIBGTOP_SERVER); server->server_command);
#endif #endif
if (pipe (server->input) || pipe (server->output)) 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]); close (server->input [0]); close (server->output [1]);
dup2 (server->input [1], 1); dup2 (server->input [1], 1);
dup2 (server->output [0], 0); 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)", glibtop_error_io_r (server, "execl (%s)",
LIBGTOP_SERVER); server->server_command);
_exit (2); _exit (2);
} }