Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
73211637
Commit
73211637
authored
Apr 27, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Avoid using wine_get_server_dir() from libwine.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e5030a4a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
13 deletions
+46
-13
server.c
dlls/ntdll/server.c
+46
-13
No files found.
dlls/ntdll/server.c
View file @
73211637
...
...
@@ -114,6 +114,7 @@ static const enum cpu_type client_cpu = CPU_ARM64;
#endif
const
char
*
config_dir
=
NULL
;
static
const
char
*
server_dir
;
unsigned
int
server_cpus
=
0
;
BOOL
is_wow64
=
FALSE
;
...
...
@@ -1216,6 +1217,38 @@ static void start_server(void)
/***********************************************************************
* init_server_dir
*/
static
const
char
*
init_server_dir
(
dev_t
dev
,
ino_t
ino
)
{
char
*
p
,
*
dir
;
size_t
len
=
sizeof
(
"/server-"
)
+
2
*
sizeof
(
dev
)
+
2
*
sizeof
(
ino
)
+
2
;
#ifdef __ANDROID__
/* there's no /tmp dir on Android */
len
+=
strlen
(
config_dir
)
+
sizeof
(
"/.wineserver"
);
dir
=
malloc
(
len
);
strcpy
(
dir
,
config_dir
);
strcat
(
dir
,
"/.wineserver/server-"
);
#else
len
+=
sizeof
(
"/tmp/.wine-"
)
+
12
;
dir
=
malloc
(
len
);
sprintf
(
dir
,
"/tmp/.wine-%u/server-"
,
getuid
()
);
#endif
p
=
dir
+
strlen
(
dir
);
if
(
dev
!=
(
unsigned
long
)
dev
)
p
+=
sprintf
(
p
,
"%lx%08lx-"
,
(
unsigned
long
)((
unsigned
long
long
)
dev
>>
32
),
(
unsigned
long
)
dev
);
else
p
+=
sprintf
(
p
,
"%lx-"
,
(
unsigned
long
)
dev
);
if
(
ino
!=
(
unsigned
long
)
ino
)
sprintf
(
p
,
"%lx%08lx"
,
(
unsigned
long
)((
unsigned
long
long
)
ino
>>
32
),
(
unsigned
long
)
ino
);
else
sprintf
(
p
,
"%lx"
,
(
unsigned
long
)
ino
);
return
dir
;
}
/***********************************************************************
* init_config_dir
*/
static
const
char
*
init_config_dir
(
void
)
...
...
@@ -1277,6 +1310,8 @@ static int setup_config_dir(void)
if
(
stat
(
"."
,
&
st
)
==
-
1
)
fatal_perror
(
"stat %s"
,
config_dir
);
if
(
st
.
st_uid
!=
getuid
())
fatal_error
(
"'%s' is not owned by you
\n
"
,
config_dir
);
server_dir
=
init_server_dir
(
st
.
st_dev
,
st
.
st_ino
);
if
(
!
mkdir
(
"dosdevices"
,
0777
))
{
mkdir
(
"drive_c"
,
0777
);
...
...
@@ -1332,26 +1367,24 @@ static void server_connect_error( const char *serverdir )
*/
static
int
server_connect
(
void
)
{
const
char
*
serverdir
;
struct
sockaddr_un
addr
;
struct
stat
st
;
int
s
,
slen
,
retry
,
fd_cwd
;
fd_cwd
=
setup_config_dir
();
serverdir
=
wine_get_server_dir
();
/* chdir to the server directory */
if
(
chdir
(
serverdir
)
==
-
1
)
if
(
chdir
(
server
_
dir
)
==
-
1
)
{
if
(
errno
!=
ENOENT
)
fatal_perror
(
"chdir to %s"
,
serverdir
);
if
(
errno
!=
ENOENT
)
fatal_perror
(
"chdir to %s"
,
server
_
dir
);
start_server
();
if
(
chdir
(
server
dir
)
==
-
1
)
fatal_perror
(
"chdir to %s"
,
server
dir
);
if
(
chdir
(
server
_dir
)
==
-
1
)
fatal_perror
(
"chdir to %s"
,
server_
dir
);
}
/* make sure we are at the right place */
if
(
stat
(
"."
,
&
st
)
==
-
1
)
fatal_perror
(
"stat %s"
,
serverdir
);
if
(
st
.
st_uid
!=
getuid
())
fatal_error
(
"'%s' is not owned by you
\n
"
,
serverdir
);
if
(
st
.
st_mode
&
077
)
fatal_error
(
"'%s' must not be accessible by other users
\n
"
,
serverdir
);
if
(
stat
(
"."
,
&
st
)
==
-
1
)
fatal_perror
(
"stat %s"
,
server
_
dir
);
if
(
st
.
st_uid
!=
getuid
())
fatal_error
(
"'%s' is not owned by you
\n
"
,
server
_
dir
);
if
(
st
.
st_mode
&
077
)
fatal_error
(
"'%s' must not be accessible by other users
\n
"
,
server
_
dir
);
for
(
retry
=
0
;
retry
<
6
;
retry
++
)
{
...
...
@@ -1364,16 +1397,16 @@ static int server_connect(void)
}
else
if
(
lstat
(
SOCKETNAME
,
&
st
)
==
-
1
)
/* check for an already existing socket */
{
if
(
errno
!=
ENOENT
)
fatal_perror
(
"lstat %s/%s"
,
serverdir
,
SOCKETNAME
);
if
(
errno
!=
ENOENT
)
fatal_perror
(
"lstat %s/%s"
,
server
_
dir
,
SOCKETNAME
);
start_server
();
if
(
lstat
(
SOCKETNAME
,
&
st
)
==
-
1
)
continue
;
/* still no socket, wait a bit more */
}
/* make sure the socket is sane (ISFIFO needed for Solaris) */
if
(
!
S_ISSOCK
(
st
.
st_mode
)
&&
!
S_ISFIFO
(
st
.
st_mode
))
fatal_error
(
"'%s/%s' is not a socket
\n
"
,
serverdir
,
SOCKETNAME
);
fatal_error
(
"'%s/%s' is not a socket
\n
"
,
server
_
dir
,
SOCKETNAME
);
if
(
st
.
st_uid
!=
getuid
())
fatal_error
(
"'%s/%s' is not owned by you
\n
"
,
serverdir
,
SOCKETNAME
);
fatal_error
(
"'%s/%s' is not owned by you
\n
"
,
server
_
dir
,
SOCKETNAME
);
/* try to connect to it */
addr
.
sun_family
=
AF_UNIX
;
...
...
@@ -1403,7 +1436,7 @@ static int server_connect(void)
}
close
(
s
);
}
server_connect_error
(
serverdir
);
server_connect_error
(
server
_
dir
);
}
...
...
@@ -1426,7 +1459,7 @@ static void send_server_task_port(void)
if
(
task_get_bootstrap_port
(
mach_task_self
(),
&
bootstrap_port
)
!=
KERN_SUCCESS
)
return
;
kret
=
bootstrap_look_up
(
bootstrap_port
,
(
char
*
)
wine_get_server_dir
()
,
&
wineserver_port
);
kret
=
bootstrap_look_up
(
bootstrap_port
,
server_dir
,
&
wineserver_port
);
if
(
kret
!=
KERN_SUCCESS
)
fatal_error
(
"cannot find the server port: 0x%08x
\n
"
,
kret
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment