Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-02-22 17:51:16 +0300
committerCorinna Vinschen <corinna@vinschen.de>2001-02-22 17:51:16 +0300
commitc5a4eacc6902e3a09e1074570fb1642974436fab (patch)
tree2e378be8d3ed758e273499f214c4053ed7be3ee0 /winsup/cygwin/shortcut.c
parent79e56091c9e4f21ecf1807e0f0f4441ddddc84e6 (diff)
* cygerrno.h: Revert previous patch.
* errno.cc: Ditto. * dir.cc: Eliminate `dir_suffixes'. (opendir): Remove usage of `dir_suffixes'. (rmdir): Ditto. * fhandler.cc (fhandler_disk_file::open): Remove usage of `inner_suffixes'. * path.cc: Rename `inner_suffixes' to `lnk_suffixes'. (path_conv::check): Remove usage of `inner_suffixes'. (symlink): Ditto. (symlink_info::check): Handle checking for `.lnk' in path_conv exclusively here. (chdir): Remove usage of `dir_suffixes'. * shortcut.c: Eliminate debug_printf lines. (check_shortcut): Don't set error except on failing ReadFile. * spawn.cc: Remove ".lnk" from `std_suffixes'. * syscalls.cc (_unlink): Remove usage of `inner_suffixes'. Remove ".lnk" from `stat_suffixes'. (_rename): Add check for renaming a symlink to keep the ".lnk" suffix after renaming.
Diffstat (limited to 'winsup/cygwin/shortcut.c')
-rw-r--r--winsup/cygwin/shortcut.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/winsup/cygwin/shortcut.c b/winsup/cygwin/shortcut.c
index 7c05f9db3..87db49a7c 100644
--- a/winsup/cygwin/shortcut.c
+++ b/winsup/cygwin/shortcut.c
@@ -16,14 +16,11 @@ details. */
#include <sys/types.h>
#include <sys/mount.h>
#include <errno.h>
-#include "cygerrno.h"
#include "shortcut.h"
/* This is needed to avoid including path.h which is a pure C++ header. */
#define PATH_SYMLINK MOUNT_SYMLINK
-#define debug_printf(x) strcpy (contents, x)
-
char shortcut_header[SHORTCUT_HDR_SIZE];
BOOL shortcut_initalized = FALSE;
@@ -71,25 +68,16 @@ check_shortcut (const char *path, DWORD fileattr, HANDLE h,
hres = CoCreateInstance (&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellLink, (void **)&psl);
if (FAILED (hres))
- {
- debug_printf ("CoCreateInstance failed");
- goto close_it;
- }
+ goto close_it;
/* Get a pointer to the IPersistFile interface. */
hres = psl->lpVtbl->QueryInterface (psl, &IID_IPersistFile, (void **)&ppf);
if (FAILED (hres))
- {
- debug_printf ("QueryInterface failed");
- goto close_it;
- }
+ goto close_it;
/* Load the shortcut. */
MultiByteToWideChar(CP_ACP, 0, path, -1, wc_path, MAX_PATH);
hres = ppf->lpVtbl->Load (ppf, wc_path, STGM_READ);
if (FAILED (hres))
- {
- debug_printf ("Load failed");
- goto close_it;
- }
+ goto close_it;
/* Try the description (containing a POSIX path) first. */
if (fileattr & FILE_ATTRIBUTE_READONLY)
{
@@ -100,18 +88,14 @@ check_shortcut (const char *path, DWORD fileattr, HANDLE h,
if (! ReadFile (h, file_header, SHORTCUT_HDR_SIZE, &got, 0))
{
- debug_printf ("ReadFile failed");
*error = EIO;
- goto close_it_dont_set_error;
+ goto close_it;
}
if (got == SHORTCUT_HDR_SIZE && !cmp_shortcut_header (file_header))
{
hres = psl->lpVtbl->GetDescription (psl, contents, MAX_PATH);
if (FAILED (hres))
- {
- debug_printf ("GetDescription failed");
- goto close_it;
- }
+ goto close_it;
len = strlen (contents);
}
}
@@ -135,27 +119,17 @@ check_shortcut (const char *path, DWORD fileattr, HANDLE h,
/* Set relative path inside of IShellLink interface. */
hres = psl->lpVtbl->SetRelativePath (psl, full_path, 0);
if (FAILED (hres))
- {
- debug_printf ("SetRelativePath failed");
- goto close_it;
- }
+ goto close_it;
/* Get the path to the shortcut target. */
hres = psl->lpVtbl->GetPath (psl, contents, MAX_PATH, &wfd, 0);
if (FAILED(hres))
- {
- debug_printf ("GetPath failed");
- goto close_it;
- }
+ goto close_it;
}
/* It's a symlink. */
*pflags = PATH_SYMLINK;
res = strlen (contents);
close_it:
- if (FAILED (hres))
- *error = geterrno_from_win_error (HRESULT_CODE (hres), EACCES);
-
-close_it_dont_set_error:
/* Release the pointer to IPersistFile. */
if (ppf)
ppf->lpVtbl->Release(ppf);