aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Error.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Error.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Error.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c
index 0d4ef3107..6b91ea94d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Error.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c
@@ -325,16 +325,13 @@ void nxagentEndRedirectToClientsLog(void)
char *nxagentGetHomePath(void)
{
- char *homeEnv;
- char *homePath;
-
if (*nxagentHomeDir == '\0')
{
/*
* Check the NX_HOME environment.
*/
- homeEnv = getenv("NX_HOME");
+ char *homeEnv = getenv("NX_HOME");
if (homeEnv == NULL || *homeEnv == '\0')
{
@@ -369,7 +366,7 @@ char *nxagentGetHomePath(void)
#endif
}
- homePath = strdup(nxagentHomeDir);
+ char *homePath = strdup(nxagentHomeDir);
if (homePath == NULL)
{
@@ -385,19 +382,13 @@ char *nxagentGetHomePath(void)
char *nxagentGetRootPath(void)
{
- char *rootEnv;
- char *homeEnv;
- char *rootPath;
-
- struct stat dirStat;
-
if (*nxagentRootDir == '\0')
{
/*
* Check the NX_ROOT environment.
*/
- rootEnv = getenv("NX_ROOT");
+ char *rootEnv = getenv("NX_ROOT");
if (rootEnv == NULL || *rootEnv == '\0')
{
@@ -406,12 +397,11 @@ char *nxagentGetRootPath(void)
#endif
/*
- * We will determine the root NX directory
- * based on the NX_HOME or HOME directory
- * settings.
+ * We will determine the root NX directory based on the NX_HOME
+ * or HOME directory settings.
*/
- homeEnv = nxagentGetHomePath();
+ char *homeEnv = nxagentGetHomePath();
if (homeEnv == NULL)
{
@@ -443,6 +433,7 @@ char *nxagentGetRootPath(void)
* Create the NX root directory.
*/
+ struct stat dirStat;
if ((stat(nxagentRootDir, &dirStat) == -1) && (errno == ENOENT))
{
if (mkdir(nxagentRootDir, 0777) < 0 && (errno != EEXIST))
@@ -478,7 +469,7 @@ char *nxagentGetRootPath(void)
}
- rootPath = strdup(nxagentRootDir);
+ char *rootPath = strdup(nxagentRootDir);
if (rootPath == NULL)
{
@@ -494,19 +485,12 @@ char *nxagentGetRootPath(void)
char *nxagentGetSessionPath(void)
{
-
- char *rootPath;
- char *sessionPath;
-
- struct stat dirStat;
-
if (*nxagentSessionDir == '\0')
{
/*
- * If nxagentSessionId does not exist we
- * assume that the sessionPath cannot be
- * realized and do not use the clients
- * log file.
+ * If nxagentSessionId does not exist we assume that the
+ * sessionPath cannot be realized and do not use the clients log
+ * file.
*/
if (*nxagentSessionId == '\0')
@@ -518,7 +502,7 @@ char *nxagentGetSessionPath(void)
return NULL;
}
- rootPath = nxagentGetRootPath();
+ char *rootPath = nxagentGetRootPath();
if (rootPath == NULL)
{
@@ -544,6 +528,7 @@ char *nxagentGetSessionPath(void)
SAFE_free(rootPath);
+ struct stat dirStat;
if ((stat(nxagentSessionDir, &dirStat) == -1) && (errno == ENOENT))
{
if (mkdir(nxagentSessionDir, 0777) < 0 && (errno != EEXIST))
@@ -564,7 +549,7 @@ char *nxagentGetSessionPath(void)
}
- sessionPath = strdup(nxagentSessionDir);
+ char *sessionPath = strdup(nxagentSessionDir);
if (sessionPath == NULL)
{
@@ -580,7 +565,6 @@ char *nxagentGetSessionPath(void)
void nxagentGetClientsPath(void)
{
-
if (*nxagentClientsLogName == '\0')
{
char *sessionPath = nxagentGetSessionPath();