From bf11a54f54d43142f3b05258239a1964bf4693cc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Mar 2001 13:05:56 +0000 Subject: [PATCH] * path.cc (suffix_scan::has): Change order of conditionals to allow checking for .lnk suffixes even if in_suffixes is empty. --- winsup/cygwin/ChangeLog | 7 ++++++- winsup/cygwin/path.cc | 18 +++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 47901fcea..064f610f7 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,4 +1,9 @@ -Tue Mar 6 13:02:00 2001 Jason Tiller +Tue Mar 6 14:02:00 2001 Corinna Vinschen + + * path.cc (suffix_scan::has): Change order of conditionals + to allow checking for .lnk suffixes even if in_suffixes is empty. + +Tue Mar 6 13:02:00 2001 Corinna Vinschen * autoload.c (cygwin_premain0): Add missing parameter. * binmode.c (cygwin_premain0): Ditto. diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index cf026fe82..94111ad12 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2426,10 +2426,10 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes, char **ex suffixes = in_suffixes; nullterm = 0; state = SCAN_BEG; - if (suffixes) + ext_here = *ext_where = strrchr (in_path, '.'); + if (ext_here) { - ext_here = *ext_where = strrchr (in_path, '.'); - if (ext_here) + if (suffixes) { /* Check if the extension matches a known extension */ for (const suffix_info *ex = in_suffixes; ex->name != NULL; ex++) @@ -2438,12 +2438,12 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes, char **ex state = SCAN_JUSTCHECK; goto known_suffix; } - /* Didn't match. Use last resort -- .lnk. */ - if (strcasematch (ext_here, ".lnk")) - { - state = SCAN_LNK; - goto known_suffix; - } + } + /* Didn't match. Use last resort -- .lnk. */ + if (strcasematch (ext_here, ".lnk")) + { + state = SCAN_LNK; + goto known_suffix; } }