Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lois Gomez
wine
Commits
870bba3e
Commit
870bba3e
authored
16 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
ntdll: Automatically setup the dosdevices directory if it doesn't exist.
parent
aab8fae5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/ntdll/server.c
+81
-71
81 additions, 71 deletions
dlls/ntdll/server.c
with
81 additions
and
71 deletions
dlls/ntdll/server.c
+
81
−
71
View file @
870bba3e
...
...
@@ -729,6 +729,81 @@ static void start_server(void)
}
/***********************************************************************
* setup_config_dir
*
* Setup the wine configuration dir.
*/
static
void
setup_config_dir
(
void
)
{
const
char
*
p
,
*
config_dir
=
wine_get_config_dir
();
pid_t
pid
,
wret
;
if
(
chdir
(
config_dir
)
==
-
1
)
{
if
(
errno
!=
ENOENT
)
fatal_perror
(
"chdir to %s
\n
"
,
config_dir
);
if
((
p
=
strrchr
(
config_dir
,
'/'
))
&&
p
!=
config_dir
)
{
struct
stat
st
;
char
*
tmp_dir
;
if
(
!
(
tmp_dir
=
malloc
(
p
+
1
-
config_dir
)))
fatal_error
(
"out of memory
\n
"
);
memcpy
(
tmp_dir
,
config_dir
,
p
-
config_dir
);
tmp_dir
[
p
-
config_dir
]
=
0
;
if
(
!
stat
(
tmp_dir
,
&
st
)
&&
st
.
st_uid
!=
getuid
())
fatal_error
(
"'%s' is not owned by you, refusing to create a configuration directory there
\n
"
,
tmp_dir
);
free
(
tmp_dir
);
}
mkdir
(
config_dir
,
0777
);
if
(
chdir
(
config_dir
)
==
-
1
)
fatal_perror
(
"chdir to %s
\n
"
,
config_dir
);
MESSAGE
(
"wine: creating configuration directory '%s'...
\n
"
,
config_dir
);
}
if
(
mkdir
(
"dosdevices"
,
0777
)
==
-
1
)
{
if
(
errno
==
EEXIST
)
return
;
fatal_perror
(
"cannot create %s/dosdevices
\n
"
,
config_dir
);
}
/* create the drive symlinks */
mkdir
(
"drive_c"
,
0777
);
symlink
(
"../drive_c"
,
"dosdevices/c:"
);
symlink
(
"/"
,
"dosdevices/z:"
);
pid
=
fork
();
if
(
pid
==
-
1
)
fatal_perror
(
"fork"
);
if
(
!
pid
)
{
char
*
argv
[
3
];
static
char
argv0
[]
=
"tools/wineprefixcreate"
,
argv1
[]
=
"--quiet"
;
argv
[
0
]
=
argv0
;
argv
[
1
]
=
argv1
;
argv
[
2
]
=
NULL
;
wine_exec_wine_binary
(
argv
[
0
],
argv
,
NULL
);
fatal_perror
(
"could not exec wineprefixcreate"
);
}
else
{
int
status
;
while
((
wret
=
waitpid
(
pid
,
&
status
,
0
))
!=
pid
)
{
if
(
wret
==
-
1
&&
errno
!=
EINTR
)
fatal_perror
(
"wait4"
);
}
if
(
!
WIFEXITED
(
status
)
||
WEXITSTATUS
(
status
))
fatal_error
(
"wineprefixcreate failed while creating '%s'.
\n
"
,
config_dir
);
}
MESSAGE
(
"wine: '%s' created successfully.
\n
"
,
config_dir
);
}
/***********************************************************************
* server_connect_error
*
...
...
@@ -768,8 +843,9 @@ static void server_connect_error( const char *serverdir )
* Attempt to connect to an existing server socket.
* We need to be in the server directory already.
*/
static
int
server_connect
(
const
char
*
serverdir
)
static
int
server_connect
(
void
)
{
const
char
*
serverdir
;
struct
sockaddr_un
addr
;
struct
stat
st
;
int
s
,
slen
,
retry
,
fd_cwd
;
...
...
@@ -778,6 +854,9 @@ static int server_connect( const char *serverdir )
fd_cwd
=
open
(
"."
,
O_RDONLY
);
if
(
fd_cwd
!=
-
1
)
fcntl
(
fd_cwd
,
F_SETFD
,
1
);
/* set close on exec flag */
setup_config_dir
();
serverdir
=
wine_get_server_dir
();
/* chdir to the server directory */
if
(
chdir
(
serverdir
)
==
-
1
)
{
...
...
@@ -838,63 +917,6 @@ static int server_connect( const char *serverdir )
}
/***********************************************************************
* create_config_dir
*
* Create the wine configuration dir (~/.wine).
*/
static
void
create_config_dir
(
void
)
{
const
char
*
p
,
*
config_dir
=
wine_get_config_dir
();
pid_t
pid
,
wret
;
if
((
p
=
strrchr
(
config_dir
,
'/'
))
&&
p
!=
config_dir
)
{
struct
stat
st
;
char
*
tmp_dir
;
if
(
!
(
tmp_dir
=
malloc
(
p
+
1
-
config_dir
)))
fatal_error
(
"out of memory
\n
"
);
memcpy
(
tmp_dir
,
config_dir
,
p
-
config_dir
);
tmp_dir
[
p
-
config_dir
]
=
0
;
if
(
!
stat
(
tmp_dir
,
&
st
)
&&
st
.
st_uid
!=
getuid
())
fatal_error
(
"'%s' is not owned by you, refusing to create a configuration directory there
\n
"
,
tmp_dir
);
free
(
tmp_dir
);
}
if
(
mkdir
(
config_dir
,
0777
)
==
-
1
&&
errno
!=
EEXIST
)
fatal_perror
(
"cannot create directory %s"
,
config_dir
);
MESSAGE
(
"wine: creating configuration directory '%s'...
\n
"
,
config_dir
);
pid
=
fork
();
if
(
pid
==
-
1
)
fatal_perror
(
"fork"
);
if
(
!
pid
)
{
char
*
argv
[
3
];
static
char
argv0
[]
=
"tools/wineprefixcreate"
,
argv1
[]
=
"--quiet"
;
argv
[
0
]
=
argv0
;
argv
[
1
]
=
argv1
;
argv
[
2
]
=
NULL
;
wine_exec_wine_binary
(
argv
[
0
],
argv
,
NULL
);
fatal_perror
(
"could not exec wineprefixcreate"
);
}
else
{
int
status
;
while
((
wret
=
waitpid
(
pid
,
&
status
,
0
))
!=
pid
)
{
if
(
wret
==
-
1
&&
errno
!=
EINTR
)
fatal_perror
(
"wait4"
);
}
if
(
!
WIFEXITED
(
status
)
||
WEXITSTATUS
(
status
))
fatal_error
(
"wineprefixcreate failed while creating '%s'.
\n
"
,
config_dir
);
}
MESSAGE
(
"wine: '%s' created successfully.
\n
"
,
config_dir
);
}
#ifdef __APPLE__
#include
<mach/mach.h>
#include
<mach/mach_error.h>
...
...
@@ -955,19 +977,7 @@ void server_init_process(void)
fatal_perror
(
"Bad server socket %d"
,
fd_socket
);
unsetenv
(
"WINESERVERSOCKET"
);
}
else
{
const
char
*
server_dir
=
wine_get_server_dir
();
if
(
!
server_dir
)
/* this means the config dir doesn't exist */
{
create_config_dir
();
server_dir
=
wine_get_server_dir
();
}
/* connect to the server */
fd_socket
=
server_connect
(
server_dir
);
}
else
fd_socket
=
server_connect
();
/* setup the signal mask */
sigemptyset
(
&
server_block_set
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment