diff options
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index e9ee64d81..d6ef25c58 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -150,7 +150,7 @@ _unlink (const char *ourname) /* Windows 9x seems to report ERROR_ACCESS_DENIED rather than sharing violation. So, set lasterr to ERROR_SHARING_VIOLATION in this case to simplify tests. */ - if (!iswinnt && lasterr == ERROR_ACCESS_DENIED + if (wincap.access_denied_on_delete () && lasterr == ERROR_ACCESS_DENIED && !win32_name.isremote ()) lasterr = ERROR_SHARING_VIOLATION; @@ -168,7 +168,8 @@ _unlink (const char *ourname) bool delete_on_close_ok; - delete_on_close_ok = !win32_name.isremote () && iswinnt; + delete_on_close_ok = !win32_name.isremote () + && wincap.has_delete_on_close (); /* Attempt to use "delete on close" semantics to handle removing a file which may be open. */ @@ -609,8 +610,14 @@ _link (const char *a, const char *b) } /* Try to make hard link first on Windows NT */ - if (iswinnt) + if (wincap.has_hard_links ()) { + if (CreateHardLinkA (real_b.get_win32 (), real_a.get_win32 (), NULL)) + { + res = 0; + goto done; + } + HANDLE hFileSource; WIN32_STREAM_ID StreamId; @@ -726,7 +733,7 @@ chown_worker (const char *name, unsigned fmode, uid_t uid, gid_t gid) if (check_null_empty_str_errno (name)) return -1; - if (!iswinnt) // real chown only works on NT + if (!wincap.has_security ()) // real chown only works on NT res = 0; // return zero (and do nothing) under Windows 9x else { @@ -1093,7 +1100,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf, dtype = real_path.get_drive_type (); if ((atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) || - (iswinnt + (wincap.can_open_directories () && dtype != DRIVE_NO_ROOT_DIR && dtype != DRIVE_UNKNOWN))) { @@ -1357,7 +1364,7 @@ _rename (const char *oldpath, const char *newpath) && GetLastError () != ERROR_FILE_EXISTS)) goto done; - if (iswinnt) + if (wincap.has_move_file_ex ()) { if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (), MOVEFILE_REPLACE_EXISTING)) @@ -1481,7 +1488,7 @@ check_posix_perm (const char *fname, int v) extern int allow_ntea, allow_ntsec, allow_smbntsec; /* Windows 95/98/ME don't support file system security at all. */ - if (!iswinnt) + if (!wincap.has_security ()) return 0; /* ntea is ok for supporting permission bits but it doesn't support @@ -2022,7 +2029,7 @@ extern "C" int seteuid (uid_t uid) { sigframe thisframe (mainthread); - if (iswinnt) + if (wincap.has_security ()) { char orig_username[UNLEN + 1]; char orig_domain[INTERNET_MAX_HOST_NAME_LENGTH + 1]; @@ -2237,7 +2244,7 @@ extern "C" int setegid (gid_t gid) { sigframe thisframe (mainthread); - if (iswinnt) + if (wincap.has_security ()) { if (gid != (gid_t) -1) { |