Commit 25c7f025 authored by Mike Gabriel's avatar Mike Gabriel

Use basename() to derive nxagentProgName cleanly.

parent 37383646
...@@ -40,6 +40,7 @@ is" without express or implied warranty. ...@@ -40,6 +40,7 @@ is" without express or implied warranty.
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <libgen.h>
#ifdef __sun #ifdef __sun
#include <strings.h> #include <strings.h>
...@@ -125,7 +126,7 @@ extern int _XGetBitsPerPixel(Display *dpy, int depth); ...@@ -125,7 +126,7 @@ extern int _XGetBitsPerPixel(Display *dpy, int depth);
extern char dispatchExceptionAtReset; extern char dispatchExceptionAtReset;
const char *nxagentProgName; char *nxagentProgName;
char nxagentDisplayName[NXAGENTDISPLAYNAMELENGTH]; char nxagentDisplayName[NXAGENTDISPLAYNAMELENGTH];
Bool nxagentSynchronize = False; Bool nxagentSynchronize = False;
...@@ -188,7 +189,9 @@ int ddxProcessArgument(int argc, char *argv[], int i) ...@@ -188,7 +189,9 @@ int ddxProcessArgument(int argc, char *argv[], int i)
* Ensure that the options are set to their defaults. * 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 * Check if we running as X2Go Agent
......
...@@ -194,7 +194,7 @@ int nxagentX2go; ...@@ -194,7 +194,7 @@ int nxagentX2go;
void checkX2goAgent(void) void checkX2goAgent(void)
{ {
extern const char *nxagentProgName; extern char *nxagentProgName;
if( strcasecmp(nxagentProgName,"x2goagent") == 0) if( strcasecmp(nxagentProgName,"x2goagent") == 0)
{ {
fprintf(stderr, "\nrunning as X2Go Agent\n"); fprintf(stderr, "\nrunning as X2Go Agent\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment