summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-02-14 00:03:32 -0800
committerJay Sorg <jay.sorg@gmail.com>2012-02-14 00:03:32 -0800
commit2225aa80ad36e88d5a55b743115fd33994703c6f (patch)
tree9cc83a0dd14540057822be7fb47fe6808283d1ae /common
parent93939893de95a8419ba067b358c951b036d78cc7 (diff)
downloadxrdp-proprietary-2225aa80ad36e88d5a55b743115fd33994703c6f.tar.gz
xrdp-proprietary-2225aa80ad36e88d5a55b743115fd33994703c6f.zip
fork change
Diffstat (limited to 'common')
-rw-r--r--common/os_calls.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index d98d4027..9e064c49 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -80,6 +80,7 @@ extern char** environ;
#endif
static char g_temp_base[128] = "";
+static char g_temp_base_org[128] = "";
/*****************************************************************************/
void APP_CC
@@ -100,8 +101,10 @@ g_init(const char* app_name)
g_create_dir("/tmp/.xrdp");
g_chmod_hex("/tmp/.xrdp", 0x1777);
}
- snprintf(g_temp_base, sizeof(g_temp_base), "/tmp/.xrdp/%s-XXXXXX",
- app_name);
+ snprintf(g_temp_base, sizeof(g_temp_base),
+ "/tmp/.xrdp/%s-XXXXXX", app_name);
+ snprintf(g_temp_base_org, sizeof(g_temp_base_org),
+ "/tmp/.xrdp/%s-XXXXXX", app_name);
if (mkdtemp(g_temp_base) == 0)
{
printf("g_init: mkdtemp failed [%s]\n", g_temp_base);
@@ -1936,7 +1939,18 @@ g_fork(void)
#if defined(_WIN32)
return 0;
#else
- return fork();
+ int rv;
+
+ rv = fork();
+ if (rv == 0) /* child */
+ {
+ g_strncpy(g_temp_base, g_temp_base_org, 127);
+ if (mkdtemp(g_temp_base) == 0)
+ {
+ printf("g_fork: mkdtemp failed [%s]\n", g_temp_base);
+ }
+ }
+ return rv;
#endif
}