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 00:49:37 +0300
committerCorinna Vinschen <corinna@vinschen.de>2001-02-22 00:49:37 +0300
commit10b06c5ee0712991bc7cec3688f8059069f9fcd2 (patch)
tree52156053d0ae8881b6c7e52fe3a0bc568f0eccb8 /winsup/cygwin/syscalls.cc
parent5b2ea3a43613c3d93ca9549880d3fd2dbb9ec0e1 (diff)
* Makefile.in: Add `-lshell32 -luuid' to link pass for new-cygwin1.dll.
* autoload.cc: Add LoadDLLinitfunc for ole32.dll. Add LoadDLLfuncEx statements for CoInitialize@4, CoUninitialize@0 and CoCreateInstance@20. * dir.cc (dir_suffixes): New datastructure. (readdir): Check for R/O *.lnk files to hide the suffix. (opendir): Use `dir_suffixes' in path conversion. (rmdir): Ditto. * fhandler.cc (fhandler_disk_file::fstat): Add S_IFLNK flag before calling `get_file_attribute'. Take FILE_ATTRIBUTE_READONLY into account only if the file is no symlink. * path.cc (inner_suffixes): New datastructure. (SYMLINKATTR): Eliminated. (path_conv::check): Use `inner_suffixes' on inner path components. (shortcut_header): New global static variable. (shortcut_initalized): Ditto. (create_shortcut_header): New function. (cmp_shortcut_header): Ditto. (symlink): Create symlinks by creating windows shortcuts. Preserve the old code. (symlink_info::check_shortcut): New method. (symlink_info::check_sysfile): Ditto. (symlink_info::check): Check for shortcuts. Move code reading old system attribute symlinks into symlink_info::check_sysfile(). (chdir): Use `dir_suffixes' in path conversion. * security.cc (get_file_attribute): Check for S_IFLNK flag. Force 0777 permissions then. * spawn.cc (std_suffixes): Add ".lnk" suffix. * syscalls.cc (_unlink): Use `inner_suffixes' in path conversion. Check for shortcut symlinks to eliminate R/O attribute before calling DeleteFile(). (stat_suffixes): Add ".lnk" suffix. (stat_worker): Force 0777 permissions if file is a symlink.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index d5bb510ee..efe2c69ea 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -65,10 +65,11 @@ close_all_files (void)
extern "C" int
_unlink (const char *ourname)
{
+ extern suffix_info inner_suffixes[];
int res = -1;
sigframe thisframe (mainthread);
- path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL);
+ path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL, inner_suffixes);
if (win32_name.error)
{
@@ -94,6 +95,15 @@ _unlink (const char *ourname)
goto done;
}
+ /* Check for shortcut as symlink condition. */
+ if (atts != 0xffffffff && atts & FILE_ATTRIBUTE_READONLY)
+ {
+ int len = strlen (win32_name.get_win32 ());
+ if (len > 4 && !strcasecmp (win32_name.get_win32 () + len - 4, ".lnk"))
+ SetFileAttributes (win32_name.get_win32 (),
+ win32_name.file_attributes () & ~FILE_ATTRIBUTE_READONLY);
+ }
+
for (int i = 0; i < 2; i++)
{
if (DeleteFile (win32_name))
@@ -1021,6 +1031,7 @@ suffix_info stat_suffixes[] =
{
suffix_info ("", 1),
suffix_info (".exe", 1),
+ suffix_info (".lnk", 1),
suffix_info (NULL)
};
@@ -1135,6 +1146,8 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
buf->st_mode |= STD_RBITS | STD_XBITS;
if ((atts & FILE_ATTRIBUTE_READONLY) == 0)
buf->st_mode |= STD_WBITS;
+ if (real_path.issymlink ())
+ buf->st_mode |= S_IRWXU | S_IRWXG | S_IRWXO;
get_file_attribute (FALSE, real_path.get_win32 (),
NULL, &buf->st_uid, &buf->st_gid);
}