use functions from os_call.h

master
BLINDAUER Emmanuel 8 years ago
parent 7bd1823ceb
commit 6875dbe860

@ -207,24 +207,27 @@ env_set_user(const char *username, char **passwd_file, int display,
int DEFAULT_CC int DEFAULT_CC
env_add_xauth_user(int display, char *cookie, char *file) env_add_xauth_user(int display, char *cookie, char *file)
{ {
FILE *dp, *fd; FILE *dp;
char xauth_str[256]; char xauth_str[256];
int fd;
if ( file == NULL ) if ( file == NULL )
{ {
fd=fopen(".Xauthority", "a"); if (!g_file_exist(".Xauthority"))
if (fd == NULL) {
freopen(".Xauthority", "a", fd); fd = g_file_open(".Xauthority");
fclose(fd); g_file_close(fd);
}
g_sprintf(xauth_str, "xauth -q add :%d . %s", display, cookie); g_sprintf(xauth_str, "xauth -q add :%d . %s", display, cookie);
} }
else else
{ {
fd=fopen(file, "a"); if (!g_file_exist(file))
if (fd == NULL) {
freopen(file, "a", fd); fd = g_file_open(file);
fclose(fd); g_file_close(fd);
}
g_sprintf(xauth_str, "xauth -q -f %s add :%d . %s", file, display, cookie); g_sprintf(xauth_str, "xauth -q -f %s add :%d . %s", file, display, cookie);
} }

Loading…
Cancel
Save