aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-04-14 03:09:33 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-08-24 23:53:25 +0200
commit25c7f02523520beb73a34f7345b00277f6f5696b (patch)
tree863bd964c0fc7a90ec91a0c0beba7afabfde3ab1
parent373836468b2c21f1c3706e521a603b9dba9dd41a (diff)
downloadnx-libs-25c7f02523520beb73a34f7345b00277f6f5696b.tar.gz
nx-libs-25c7f02523520beb73a34f7345b00277f6f5696b.tar.bz2
nx-libs-25c7f02523520beb73a34f7345b00277f6f5696b.zip
Use basename() to derive nxagentProgName cleanly.
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c7
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Init.c2
2 files changed, 6 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index cdcde1224..949892f25 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -40,6 +40,7 @@ is" without express or implied warranty.
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <libgen.h>
#ifdef __sun
#include <strings.h>
@@ -125,7 +126,7 @@ extern int _XGetBitsPerPixel(Display *dpy, int depth);
extern char dispatchExceptionAtReset;
-const char *nxagentProgName;
+char *nxagentProgName;
char nxagentDisplayName[NXAGENTDISPLAYNAMELENGTH];
Bool nxagentSynchronize = False;
@@ -188,7 +189,9 @@ int ddxProcessArgument(int argc, char *argv[], int i)
* Ensure that the options are set to their defaults.
*/
- nxagentProgName = argv[0];
+ char *basec = strdup(argv[0]);
+ nxagentProgName = strdup(basename(basec));
+ free(basec);
/*
* Check if we running as X2Go Agent
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c
index 01acbbc16..d95c4b70f 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Init.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c
@@ -194,7 +194,7 @@ int nxagentX2go;
void checkX2goAgent(void)
{
- extern const char *nxagentProgName;
+ extern char *nxagentProgName;
if( strcasecmp(nxagentProgName,"x2goagent") == 0)
{
fprintf(stderr, "\nrunning as X2Go Agent\n");