public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: drop path_conv::reset_conv_handle
Date: Wed, 10 Feb 2021 09:52:02 +0000 (GMT)	[thread overview]
Message-ID: <20210210095202.ABA293851C35@sourceware.org> (raw)

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

commit 5f0913df13f227aa8087ed39ae1ac5ddf98e5671
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Feb 10 10:37:13 2021 +0100

    Cygwin: drop path_conv::reset_conv_handle
    
    path_conv::reset_conv_handle is only called after fhandler::copyto
    has been called.  This duplicated the path_conv_handle if there was
    one, so just setting the conv handle to NULL potentially produces a
    handle leak.  Replace reset_conv_handle calls with calls to
    close_conv_handle and drop the reset_conv_handle method.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/dtable.cc        | 2 +-
 winsup/cygwin/fhandler_pipe.cc | 2 +-
 winsup/cygwin/path.h           | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index ad4b59211..84149bd3f 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -687,7 +687,7 @@ dtable::dup_worker (fhandler_base *oldfh, int flags)
       if (!oldfh->archetype)
 	newfh->set_handle (NULL);
 
-      newfh->pc.reset_conv_handle ();
+      newfh->pc.close_conv_handle ();
       if (oldfh->dup (newfh, flags))
 	{
 	  delete newfh;
diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc
index edbaded68..830e8f823 100644
--- a/winsup/cygwin/fhandler_pipe.cc
+++ b/winsup/cygwin/fhandler_pipe.cc
@@ -98,7 +98,7 @@ fhandler_pipe::open (int flags, mode_t mode)
 	    continue;
 	  cfd->copyto (this);
 	  set_handle (NULL);
-	  pc.reset_conv_handle ();
+	  pc.close_conv_handle ();
 	  if (!cfd->dup (this, flags))
 	    return 1;
 	  return 0;
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 62bd5ddd5..33e7fdf6a 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -406,7 +406,6 @@ class path_conv
     return conv_handle.get_finfo (h, fs.is_nfs ());
   }
   inline ino_t get_ino () const { return conv_handle.get_ino (fs.is_nfs ()); }
-  void reset_conv_handle () { conv_handle.set (NULL); }
   void close_conv_handle () { conv_handle.close (); }
 
   ino_t get_ino_by_handle (HANDLE h);


                 reply	other threads:[~2021-02-10  9:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210210095202.ABA293851C35@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).