summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2004-06-17 13:34:26 +0000
committerPierre Humblet <phumblet@phumblet.no-ip.org>2004-06-17 13:34:26 +0000
commitbd0e9c7aa613edfdc3146014fb73c38df4748659 (patch)
tree31f22d9165d03ec109ea29e19480599e81b8abb5 /winsup/cygwin/fhandler.cc
parent9f35b464563d391929da0326ea37c15e6099cdce (diff)
downloadcygnal-bd0e9c7aa613edfdc3146014fb73c38df4748659.tar.gz
cygnal-bd0e9c7aa613edfdc3146014fb73c38df4748659.tar.bz2
cygnal-bd0e9c7aa613edfdc3146014fb73c38df4748659.zip
2004-06-17 Pierre Humblet <pierre.humblet@ieee.org>
* 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.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc35
1 files changed, 12 insertions, 23 deletions
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;