ntdll: Preserve the startup Unix directory unless it's on a removable device.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52256 Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
49ee0f58e8
commit
3e73437ae8
|
@ -6223,7 +6223,7 @@ static inline BOOL is_device_placeholder( int fd )
|
|||
return !memcmp( buffer, wine_placeholder, sizeof(wine_placeholder) - 1 );
|
||||
}
|
||||
|
||||
static NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info )
|
||||
NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info )
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winnt.h"
|
||||
#include "winioctl.h"
|
||||
#include "wine/server.h"
|
||||
#include "wine/debug.h"
|
||||
#include "unix_private.h"
|
||||
|
@ -1172,6 +1173,16 @@ static int setup_config_dir(void)
|
|||
}
|
||||
else if (errno != EEXIST) fatal_perror( "cannot create %s/dosdevices", config_dir );
|
||||
|
||||
if (fd_cwd != -1)
|
||||
{
|
||||
FILE_FS_DEVICE_INFORMATION info;
|
||||
if (!get_device_info( fd_cwd, &info ) && (info.Characteristics & FILE_REMOVABLE_MEDIA))
|
||||
{
|
||||
close( fd_cwd );
|
||||
fd_cwd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (fd_cwd == -1) fd_cwd = open( "dosdevices/c:", O_RDONLY );
|
||||
fcntl( fd_cwd, F_SETFD, FD_CLOEXEC );
|
||||
return fd_cwd;
|
||||
|
@ -1215,7 +1226,6 @@ static void server_connect_error( const char *serverdir )
|
|||
* server_connect
|
||||
*
|
||||
* Attempt to connect to an existing server socket.
|
||||
* We need to be in the server directory already.
|
||||
*/
|
||||
static int server_connect(void)
|
||||
{
|
||||
|
@ -1544,16 +1554,7 @@ void server_init_process_done(void)
|
|||
{
|
||||
void *entry, *teb;
|
||||
NTSTATUS status;
|
||||
int suspend, needs_close, unixdir;
|
||||
|
||||
if (peb->ProcessParameters->CurrentDirectory.Handle &&
|
||||
!server_get_unix_fd( peb->ProcessParameters->CurrentDirectory.Handle,
|
||||
FILE_TRAVERSE, &unixdir, &needs_close, NULL, NULL ))
|
||||
{
|
||||
fchdir( unixdir );
|
||||
if (needs_close) close( unixdir );
|
||||
}
|
||||
else chdir( "/" ); /* avoid locking removable devices */
|
||||
int suspend;
|
||||
|
||||
#ifdef __APPLE__
|
||||
send_server_task_port();
|
||||
|
|
|
@ -105,6 +105,8 @@ extern LONGLONG CDECL fast_RtlGetSystemTimePrecise(void) DECLSPEC_HIDDEN;
|
|||
extern NTSTATUS CDECL unwind_builtin_dll( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
|
||||
CONTEXT *context ) DECLSPEC_HIDDEN;
|
||||
|
||||
struct _FILE_FS_DEVICE_INFORMATION;
|
||||
|
||||
extern const char wine_build[] DECLSPEC_HIDDEN;
|
||||
|
||||
extern const char *home_dir DECLSPEC_HIDDEN;
|
||||
|
@ -267,6 +269,7 @@ extern NTSTATUS get_full_path( const WCHAR *name, const WCHAR *curdir, WCHAR **p
|
|||
extern NTSTATUS open_unix_file( HANDLE *handle, const char *unix_name, ACCESS_MASK access,
|
||||
OBJECT_ATTRIBUTES *attr, ULONG attributes, ULONG sharing, ULONG disposition,
|
||||
ULONG options, void *ea_buffer, ULONG ea_length ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS get_device_info( int fd, struct _FILE_FS_DEVICE_INFORMATION *info ) DECLSPEC_HIDDEN;
|
||||
extern void init_files(void) DECLSPEC_HIDDEN;
|
||||
extern void init_cpu_info(void) DECLSPEC_HIDDEN;
|
||||
extern void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue