From: Corinna Vinschen Date: Mon, 20 Mar 2023 11:23:36 +0000 (+0100) Subject: Cygwin: unlink: drop unlink_nt/unlink_nt_shareable wrappers X-Git-Tag: newlib-4.4.0~292 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=271292b1fbdc7da7c1ed678836eebe596170e635;p=newlib-cygwin.git Cygwin: unlink: drop unlink_nt/unlink_nt_shareable wrappers Useless indirection. Rename _unlink_nt back to unlink_nt and call the function directly with `sharable' flag as needed. Signed-off-by: Corinna Vinschen --- diff --git a/winsup/cygwin/fhandler/disk_file.cc b/winsup/cygwin/fhandler/disk_file.cc index 8528f7f8d..19c976aaa 100644 --- a/winsup/cygwin/fhandler/disk_file.cc +++ b/winsup/cygwin/fhandler/disk_file.cc @@ -1836,7 +1836,7 @@ fhandler_disk_file::mkdir (mode_t mode) int fhandler_disk_file::rmdir () { - extern NTSTATUS unlink_nt (path_conv &pc); + extern NTSTATUS unlink_nt (path_conv &pc, bool sharable); if (!pc.isdir ()) { @@ -1849,7 +1849,7 @@ fhandler_disk_file::rmdir () return -1; } - NTSTATUS status = unlink_nt (pc); + NTSTATUS status = unlink_nt (pc, false); if (!NT_SUCCESS (status)) { diff --git a/winsup/cygwin/forkable.cc b/winsup/cygwin/forkable.cc index fbc30ae30..c69c8bea9 100644 --- a/winsup/cygwin/forkable.cc +++ b/winsup/cygwin/forkable.cc @@ -29,7 +29,7 @@ details. */ /* Allow concurrent processes to use the same dll or exe * via their hardlink while we delete our hardlink. */ -extern NTSTATUS unlink_nt_shareable (path_conv &pc); +extern NTSTATUS unlink_nt (path_conv &pc, bool sharable); #define MUTEXSEP L"@" #define PATHSEP L"\\" @@ -132,7 +132,7 @@ rmdirs (WCHAR ntmaxpathbuf[NT_MAX_PATH]) RtlInitUnicodeString (&fn, ntmaxpathbuf); path_conv pc (&fn); - unlink_nt_shareable (pc); /* move to bin */ + unlink_nt (pc, true); /* move to bin */ } if (!pfdi->NextEntryOffset) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 8ae0397fb..af4f87085 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -665,8 +665,8 @@ _unlink_nt_post_dir_check (NTSTATUS status, POBJECT_ATTRIBUTES attr, const path_ return status; } -static NTSTATUS -_unlink_nt (path_conv &pc, bool shareable) +NTSTATUS +unlink_nt (path_conv &pc, bool shareable) { NTSTATUS status; HANDLE fh, fh_ro = NULL; @@ -1062,18 +1062,6 @@ out: return status; } -NTSTATUS -unlink_nt (path_conv &pc) -{ - return _unlink_nt (pc, false); -} - -NTSTATUS -unlink_nt_shareable (path_conv &pc) -{ - return _unlink_nt (pc, true); -} - extern "C" int unlink (const char *ourname) { @@ -1113,7 +1101,7 @@ unlink (const char *ourname) goto done; } - status = unlink_nt (win32_name); + status = unlink_nt (win32_name, false); if (NT_SUCCESS (status)) res = 0; else @@ -2504,7 +2492,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int at2flags) unlink_nt returns with STATUS_DIRECTORY_NOT_EMPTY. */ if (dstpc->isdir ()) { - status = unlink_nt (*dstpc); + status = unlink_nt (*dstpc, false); if (!NT_SUCCESS (status)) { __seterrno_from_nt_status (status); @@ -2645,7 +2633,7 @@ skip_pre_W10_checks: ? FILE_OPEN_REPARSE_POINT : 0)); if (NT_SUCCESS (status)) { - status = unlink_nt (*dstpc); + status = unlink_nt (*dstpc, false); if (NT_SUCCESS (status)) break; } @@ -2665,7 +2653,7 @@ skip_pre_W10_checks: if (NT_SUCCESS (status)) { if (removepc) - unlink_nt (*removepc); + unlink_nt (*removepc, false); res = 0; } else