summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-02-25 09:34:00 +0000
committerCorinna Vinschen <corinna@vinschen.de>2001-02-25 09:34:00 +0000
commit649033a811b93d7b3e77108bdfcaa33a829f9194 (patch)
treea3a2749e573b21b9ffb3ba43fb038011df1da3bd /winsup/cygwin/path.cc
parent80ed95f2ebe7d9351a51e00e6004ed000e597a59 (diff)
downloadcygnal-649033a811b93d7b3e77108bdfcaa33a829f9194.tar.gz
cygnal-649033a811b93d7b3e77108bdfcaa33a829f9194.tar.bz2
cygnal-649033a811b93d7b3e77108bdfcaa33a829f9194.zip
* path.cc (symlink): Add a ".lnk" suffix regardless. Add a comment.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index f0b48f844..681664dc0 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2202,11 +2202,9 @@ symlink (const char *topath, const char *frompath)
#if 0
path_conv win32_path (frompath, PC_SYM_NOFOLLOW);
#else
- char from[MAX_PATH];
- unsigned short len = strlen (frompath);
+ char from[MAX_PATH + 5];
strcpy (from, frompath);
- if (len <= 4 || strcasecmp (from + len - 4, ".lnk"))
- strcpy (from + len, ".lnk");
+ strcat (from, ".lnk");
path_conv win32_path (from, PC_SYM_NOFOLLOW);
path_conv win32_topath;
char cwd[MAX_PATH + 1], *cp = NULL, c = 0;
@@ -2296,7 +2294,9 @@ symlink (const char *topath, const char *frompath)
{
DWORD written;
create_shortcut_header ();
- len = strlen (topath);
+ /* Don't change the datatypes of `len' and `win_len' since
+ their sizeof is used later. */
+ unsigned short len = strlen (topath);
unsigned short win_len = strlen (w32topath);
if (WriteFile (h, shortcut_header, SHORTCUT_HDR_SIZE, &written, NULL)
&& written == SHORTCUT_HDR_SIZE