[newlib-cygwin] Cygwin: flock: drop checking for artificial console handles

Corinna Vinschen corinna@sourceware.org
Sun Dec 4 13:28:17 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=df680fb62df0bb0f30e7fda6ab0adc713937cb54

commit df680fb62df0bb0f30e7fda6ab0adc713937cb54
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Tue Nov 15 21:51:14 2022 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Sun Dec 4 14:01:41 2022 +0100

    Cygwin: flock: drop checking for artificial console handles
    
    They have been used up to Windows 7 only.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/flock.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index 50db7fe28ed0..0f1efa01d45e 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -951,10 +951,8 @@ fhandler_base::lock (int a_op, struct flock *fl)
     a_flags = F_POSIX; /* default */
 
   /* FIXME: For BSD flock(2) we need a valid, per file table entry OS handle.
-     Therefore we can't allow using flock(2) on nohandle devices and
-     pre-Windows 8 console handles (recognized by their odd handle value). */
-  if ((a_flags & F_FLOCK)
-      && (nohandle () || (((uintptr_t) get_handle () & 0x3) == 0x3)))
+     Therefore we can't allow using flock(2) on nohandle devices. */
+  if ((a_flags & F_FLOCK) && nohandle ())
     {
       set_errno (EINVAL);
       debug_printf ("BSD locking on nohandle and old-style console devices "


More information about the Cygwin-cvs mailing list