From 293ce8104da2b49fde7682913264339df7b70cd4 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 17 Aug 2003 16:33:15 +0000 Subject: [PATCH] * path.cc (special_name): Accommodate all special names with extensions. --- winsup/cygwin/ChangeLog | 15 ++++++++++----- winsup/cygwin/path.cc | 29 +++++++++++++---------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ed37e0b4d..6debe68a4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2003-08-17 Christopher Faylor + + * path.cc (special_name): Accommodate all special names with + extensions. + 2003-08-15 Corinna Vinschen * mmap.cc (mmap64): Avoid crash if file size is less than requested @@ -10,7 +15,7 @@ 2003-08-13 Corinna Vinschen - * cygwin.din: Accomodate change from cygwin_lstat to lstat. + * cygwin.din: Accommodate change from cygwin_lstat to lstat. * syscalls.cc: Add defines to avoid declaration issues when renaming cygwin_lstat back to lstat. (lstat): Reverted name change from cygwin_lstat. @@ -740,7 +745,7 @@ * shared_info.h: Match shared_name declaration with below change. * shared.cc (shared_name): Use incoming char * parameter instead of local static buffer. - (open_shared): Accomodate new calling convention for shared_name. + (open_shared): Accommodate new calling convention for shared_name. * exceptions.cc (events_init): Ditto. * sigproc.cc (getsem): Ditto. * syscalls.cc (login): Ditto. @@ -751,7 +756,7 @@ * fhandler_socket.cc (secret_event_name): Return void. Use incoming char * parameter instead of local static buffer. - (fhandler_socket::create_secret_event): Accomodate new calling + (fhandler_socket::create_secret_event): Accommodate new calling convention for secret_event_name. (fhandler_socket::close_secret_event): Ditto. @@ -770,7 +775,7 @@ * wincap.cc: Set has_terminal_services capability throughout. (wincap_2003): New global object representing Windows 2003 Server capabilities. - (wincapc::init): Accomodate Windows 2003 Server. + (wincapc::init): Accommodate Windows 2003 Server. * wincap.h (struct wincaps): Add has_terminal_services capability. 2003-05-20 Charles Wilson @@ -2222,7 +2227,7 @@ (mmap_record::fixup_map): Format change. (list::add_record): Add offset and length parameter to call mmap_record::alloc_map() correctly. - (mmap64): Rename `l' variable to `map_list'. Accomodate above changes. + (mmap64): Rename `l' variable to `map_list'. Accommodate above changes. (munmap): Rename `l' variable to `map_list'. (msync): Ditto. (fhandler_disk_file::mmap): Streamline code. diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 7241994a2..bffddce9b 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1418,24 +1418,21 @@ special_name (const char *s, int inc = 1) if (strpbrk (s, special_chars)) return !strncasematch (s, "%2f", 3); - // FIXME: add com0 and {com,lpt}N.* - if (strcasematch (s, "nul") - || strncasematch (s, "nul.", 4) - || strcasematch (s, "aux") - || strncasematch (s, "aux.", 4) - || strcasematch (s, "prn") - || strncasematch (s, "prn.", 4) - || strcasematch (s, "con") - || strncasematch (s, "con.", 4) - || strcasematch (s, "conin$") - || strcasematch (s, "conout$")) + const char *p; + if (strcasematch (s, "conin$") || strcasematch (s, "conout$")) return -1; - if (!strncasematch (s, "com", 3) - && !strncasematch (s, "lpt", 3)) + + if (strncasematch (s, "nul", 3) + || strncasematch (s, "aux", 3) + || strncasematch (s, "prn", 3) + || strncasematch (s, "con", 3)) + p = s + 3; + else if (strncasematch (s, "com", 3) || strncasematch (s, "lpt", 3)) + (void) strtoul (s + 3, (char **) &p, 10); + else return false; - char *p; - (void) strtoul (s + 3, &p, 10); - return -(*p == '\0'); + + return (*p == '\0' || *p == '.') ? -1 : false; } bool