summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
authorBLINDAUER Emmanuel <e.blindauer@gmail.com>2016-12-13 18:53:07 +0100
committerBLINDAUER Emmanuel <e.blindauer@gmail.com>2016-12-13 18:53:07 +0100
commit6875dbe8607a6a7354988b97ba60e987a7708705 (patch)
treee5f39aabcec4cb303e06a9f78007f33462c70d21 /sesman
parent7bd1823ceb2fb84d840c7ded737ce1bb60c7e3ba (diff)
downloadxrdp-proprietary-6875dbe8607a6a7354988b97ba60e987a7708705.tar.gz
xrdp-proprietary-6875dbe8607a6a7354988b97ba60e987a7708705.zip
use functions from os_call.h
Diffstat (limited to 'sesman')
-rw-r--r--sesman/env.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sesman/env.c b/sesman/env.c
index c29db8f9..5bc4e17d 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -207,24 +207,27 @@ env_set_user(const char *username, char **passwd_file, int display,
int DEFAULT_CC
env_add_xauth_user(int display, char *cookie, char *file)
{
- FILE *dp, *fd;
+ FILE *dp;
char xauth_str[256];
+ int fd;
if ( file == NULL )
{
- fd=fopen(".Xauthority", "a");
- if (fd == NULL)
- freopen(".Xauthority", "a", fd);
- fclose(fd);
+ if (!g_file_exist(".Xauthority"))
+ {
+ fd = g_file_open(".Xauthority");
+ g_file_close(fd);
+ }
g_sprintf(xauth_str, "xauth -q add :%d . %s", display, cookie);
}
else
{
- fd=fopen(file, "a");
- if (fd == NULL)
- freopen(file, "a", fd);
- fclose(fd);
+ if (!g_file_exist(file))
+ {
+ fd = g_file_open(file);
+ g_file_close(fd);
+ }
g_sprintf(xauth_str, "xauth -q -f %s add :%d . %s", file, display, cookie);
}