summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-03-14 11:13:46 +0000
committerCorinna Vinschen <corinna@vinschen.de>2001-03-14 11:13:46 +0000
commit78d2c08cd9126d39c43c6110eca65bb53c798bd2 (patch)
tree54657ba8961af6462a1e2388850c3ff90f0c840f /winsup/cygwin/path.cc
parent63dc5d80f6c1087d43610837300dd25928583b6d (diff)
downloadcygnal-78d2c08cd9126d39c43c6110eca65bb53c798bd2.tar.gz
cygnal-78d2c08cd9126d39c43c6110eca65bb53c798bd2.tar.bz2
cygnal-78d2c08cd9126d39c43c6110eca65bb53c798bd2.zip
* path.cc (lnk_suffixes): Remove.
(class suffix_scan): Add `lnk_state' flag. (suffix_scan::lnk_match): Return state of `lnk_state' now. (suffix_scan::has): Changed behaviour if file has `.lnk' suffix. (suffix_scan::next): Set `lnk_state' where appropriate. (symlink_info::check): Fix a wrong `break'. * syscalls.cc (chown_worker): Change debug statement to reflect lchown fix. (lchown): Call chown_worker with `PC_SYM_NOFOLLOW' instead of `PC_SYM_IGNORE'.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc25
1 files changed, 9 insertions, 16 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 94111ad12..3a84b0936 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -96,13 +96,6 @@ struct symlink_info
int check (const char *path, const suffix_info *suffixes);
};
-/* These suffixes are the only ones allowed in inner path components. */
-suffix_info lnk_suffixes[] =
-{
- suffix_info (".lnk", 1),
- suffix_info (NULL)
-};
-
cwdstuff cygcwd; /* The current working directory. */
#define path_prefix_p(p1, p2, l1) \
@@ -2411,12 +2404,13 @@ class suffix_scan
char *ext_here;
const suffix_info *suffixes;
int state;
+ int lnk_state;
int nullterm;
public:
const char *path;
char *has (const char *, const suffix_info *, char **);
int next ();
- int lnk_match () {return state == SCAN_LNK + 1;}
+ int lnk_match () {return lnk_state;}
};
char *
@@ -2426,6 +2420,7 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes, char **ex
suffixes = in_suffixes;
nullterm = 0;
state = SCAN_BEG;
+ lnk_state = 0;
ext_here = *ext_where = strrchr (in_path, '.');
if (ext_here)
{
@@ -2436,14 +2431,15 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes, char **ex
if (strcasematch (ext_here, ex->name))
{
state = SCAN_JUSTCHECK;
- goto known_suffix;
+ suffixes = NULL; /* Has an extension so don't scan for one. */
+ return ext_here;
}
}
/* Didn't match. Use last resort -- .lnk. */
if (strcasematch (ext_here, ".lnk"))
{
- state = SCAN_LNK;
- goto known_suffix;
+ lnk_state = 1;
+ suffixes = NULL;
}
}
@@ -2451,10 +2447,6 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes, char **ex
ext_here = *ext_where = strchr (path, '\0');
nullterm = 1;
return NULL;
-
- known_suffix:
- suffixes = NULL; /* Has an extension so don't scan for one. */
- return ext_here;
}
int
@@ -2478,6 +2470,7 @@ suffix_scan::next ()
switch (state++)
{
case SCAN_LNK:
+ lnk_state = 1;
strcpy (ext_here, ".lnk");
/* fall through */
case SCAN_BEG:
@@ -2566,7 +2559,7 @@ symlink_info::check (const char *path, const suffix_info *suffixes)
if (suffix.lnk_match ())
{
fileattr = (DWORD)-1;
- break;
+ continue;
}
goto file_not_symlink;
}