diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2004-04-30 18:02:37 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2004-04-30 18:02:37 +0400 |
commit | e6b21dafc1e29f42ac20248d29a93d37fc69e8a9 (patch) | |
tree | 4fc568d34a31a1eafe574ee778a62c044d9ff1b1 /winsup | |
parent | 72f3756e0705fe039b9005a857c23739f6944521 (diff) |
* fhandler.cc (fhandler_base::open): Fix NT native path evaluation
to allow opening serial ports.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.cc | 25 |
2 files changed, 20 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e07a3a7f9..c18f174b4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2004-04-30 Corinna Vinschen <corinna@vinschen.de> + + * fhandler.cc (fhandler_base::open): Fix NT native path evaluation + to allow opening serial ports. + 2004-04-30 DJ Delorie <dj@redhat.com> * init.cc (threadfunc_fe): Hack to make thread stacks always 16 diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 445146aa9..2dc3eece0 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -554,21 +554,26 @@ fhandler_base::open (int flags, mode_t mode) set_errno (ENOENT); goto done; } - if (get_win32_name ()[0] == '\\') + + if (get_win32_name ()[0] != '\\') /* X:\... or NUL, etc. */ { - if (get_win32_name ()[1] == '\\') - { - str2buf2uni (upath, wpath, "\\??\\UNC"); - str2buf2uni_cat (upath, get_win32_name () + 1); - } - else - str2buf2uni (upath, wpath, get_win32_name ()); + str2buf2uni (upath, wpath, "\\??\\"); + str2buf2uni_cat (upath, get_win32_name ()); } - else + else if (get_win32_name ()[1] != '\\') /* \Device\... */ + str2buf2uni (upath, wpath, get_win32_name ()); + else if (get_win32_name ()[2] != '.' + || get_win32_name ()[3] != '\\') /* \\server\share\... */ + { + str2buf2uni (upath, wpath, "\\??\\UNC\\"); + str2buf2uni_cat (upath, get_win32_name () + 2); + } + else /* \\.\device */ { str2buf2uni (upath, wpath, "\\??\\"); - str2buf2uni_cat (upath, get_win32_name ()); + str2buf2uni_cat (upath, get_win32_name () + 4); } + InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE | OBJ_INHERIT, sa.lpSecurityDescriptor, NULL); |