ntdll: Use root of c: drive as fallback cwd during startup.

Signed-off-by: Josh DuBois <duboisj@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Josh DuBois 2018-09-06 12:21:48 -05:00 committed by Alexandre Julliard
parent ffbb44b01f
commit 7f567451b2
1 changed files with 9 additions and 7 deletions

View File

@ -1124,9 +1124,10 @@ static void start_server(void)
*
* Setup the wine configuration dir.
*/
static void setup_config_dir(void)
static int setup_config_dir(void)
{
const char *p, *config_dir = wine_get_config_dir();
int fd_cwd = open( ".", O_RDONLY );
if (chdir( config_dir ) == -1)
{
@ -1154,7 +1155,7 @@ static void setup_config_dir(void)
if (mkdir( "dosdevices", 0777 ) == -1)
{
if (errno == EEXIST) return;
if (errno == EEXIST) goto done;
fatal_perror( "cannot create %s/dosdevices\n", config_dir );
}
@ -1163,6 +1164,11 @@ static void setup_config_dir(void)
mkdir( "drive_c", 0777 );
symlink( "../drive_c", "dosdevices/c:" );
symlink( "/", "dosdevices/z:" );
done:
if (fd_cwd == -1) fd_cwd = open( "dosdevices/c:", O_RDONLY );
fcntl( fd_cwd, F_SETFD, FD_CLOEXEC );
return fd_cwd;
}
@ -1212,11 +1218,7 @@ static int server_connect(void)
struct stat st;
int s, slen, retry, fd_cwd;
/* retrieve the current directory */
fd_cwd = open( ".", O_RDONLY );
if (fd_cwd != -1) fcntl( fd_cwd, F_SETFD, FD_CLOEXEC );
setup_config_dir();
fd_cwd = setup_config_dir();
serverdir = wine_get_server_dir();
/* chdir to the server directory */