From bd0e9c7aa613edfdc3146014fb73c38df4748659 Mon Sep 17 00:00:00 2001 From: Pierre Humblet Date: Thu, 17 Jun 2004 13:34:26 +0000 Subject: 2004-06-17 Pierre Humblet * fhandler.cc (fhandler_base::open_9x): Do not check for null name. Move debug_printf to common code line. (fhandler_base::open): Ditto. Initialize upath. Remove second argument of pc.get_nt_native_path. * path.h (path_conv::get_nt_native_path): Remove second argument. * path.cc (path_conv::get_nt_native_path): Ditto. Call str2uni_cat. * security.h (str2buf2uni_cat): Delete declaration. (str2uni_cat): New declaration. * security.cc (str2buf2uni): Get length from sys_mbstowcs call. (str2buf2uni_cat): Delete function. (str2uni_cat): New function. * miscfuncs.cc (sys_mbstowcs): Add debug_printf. --- winsup/cygwin/fhandler.cc | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) (limited to 'winsup/cygwin/fhandler.cc') diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 435eb983b..1ea719405 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -437,12 +437,6 @@ fhandler_base::open_9x (int flags, mode_t mode) syscall_printf ("(%s, %p)", get_win32_name (), flags); - if (get_win32_name () == NULL) - { - set_errno (ENOENT); - goto done; - } - if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY) access = GENERIC_READ; else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY) @@ -512,16 +506,16 @@ fhandler_base::open_9x (int flags, mode_t mode) goto done; } - syscall_printf ("%p = CreateFile (%s, %p, %p, %p, %p, %p, 0)", - x, get_win32_name (), access, shared, &sa, - creation_distribution, file_attributes); - set_io_handle (x); set_flags (flags, pc.binmode ()); res = 1; set_open_status (); done: + debug_printf ("%p = CreateFile (%s, %p, %p, %p, %p, %p, 0)", + x, get_win32_name (), access, shared, &sa, + creation_distribution, file_attributes); + syscall_printf ("%d = fhandler_base::open (%s, %p)", res, get_win32_name (), flags); return res; @@ -534,11 +528,11 @@ fhandler_base::open (int flags, mode_t mode) if (!wincap.is_winnt ()) return fhandler_base::open_9x (flags, mode); - UNICODE_STRING upath; WCHAR wpath[CYG_MAX_PATH + 10]; - pc.get_nt_native_path (upath, wpath); + UNICODE_STRING upath = {0, sizeof (wpath), wpath}; + pc.get_nt_native_path (upath); - if (RtlIsDosDeviceName_U (wpath)) + if (RtlIsDosDeviceName_U (upath.Buffer)) return fhandler_base::open_9x (flags, mode); int res = 0; @@ -554,11 +548,6 @@ fhandler_base::open (int flags, mode_t mode) NTSTATUS status; syscall_printf ("(%s, %p)", get_win32_name (), flags); - if (get_win32_name () == NULL) - { - set_errno (ENOENT); - goto done; - } InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE | OBJ_INHERIT, sa.lpSecurityDescriptor, NULL); @@ -657,17 +646,17 @@ fhandler_base::open (int flags, mode_t mode) goto done; } - syscall_printf ("%x = NtCreateFile " - "(%p, %x, %s, io, NULL, %x, %x, %x, %x, NULL, 0)", - status, x, access, get_win32_name (), file_attributes, shared, - create_disposition, create_options); - set_io_handle (x); set_flags (flags, pc.binmode ()); res = 1; set_open_status (); done: + debug_printf ("%x = NtCreateFile " + "(%p, %x, %s, io, NULL, %x, %x, %x, %x, NULL, 0)", + status, x, access, get_win32_name (), file_attributes, shared, + create_disposition, create_options); + syscall_printf ("%d = fhandler_base::open (%s, %p)", res, get_win32_name (), flags); return res; -- cgit v1.2.3