mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-02 12:30:24 +08:00
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>
This commit is contained in:
parent
62027d4fbf
commit
762d6fd6dd
@ -691,6 +691,17 @@ dtable::dup_worker (fhandler_base *oldfh, int flags, DWORD src_pid)
|
|||||||
if (src_pid && oldfh->archetype
|
if (src_pid && oldfh->archetype
|
||||||
&& !(newfh->archetype = find_archetype (oldfh->dev ())))
|
&& !(newfh->archetype = find_archetype (oldfh->dev ())))
|
||||||
need_new_arch = true;
|
need_new_arch = true;
|
||||||
|
newfh->pc.close_conv_handle ();
|
||||||
|
if (oldfh->dup (newfh, flags))
|
||||||
|
{
|
||||||
|
delete newfh;
|
||||||
|
newfh = NULL;
|
||||||
|
debug_printf ("oldfh->dup failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Don't increment refcnt here since we don't know if this is a
|
||||||
|
allocated fd. So we leave this chore to the caller. */
|
||||||
|
|
||||||
if (!oldfh->archetype)
|
if (!oldfh->archetype)
|
||||||
newfh->set_handle (NULL);
|
newfh->set_handle (NULL);
|
||||||
|
@ -98,7 +98,7 @@ fhandler_pipe::open (int flags, mode_t mode)
|
|||||||
continue;
|
continue;
|
||||||
cfd->copyto (this);
|
cfd->copyto (this);
|
||||||
set_handle (NULL);
|
set_handle (NULL);
|
||||||
pc.reset_conv_handle ();
|
pc.close_conv_handle ();
|
||||||
if (!cfd->dup (this, flags))
|
if (!cfd->dup (this, flags))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -406,8 +406,6 @@ class path_conv
|
|||||||
return conv_handle.get_finfo (h, fs.is_nfs ());
|
return conv_handle.get_finfo (h, fs.is_nfs ());
|
||||||
}
|
}
|
||||||
inline ino_t get_ino () const { return conv_handle.get_ino (fs.is_nfs ()); }
|
inline ino_t get_ino () const { return conv_handle.get_ino (fs.is_nfs ()); }
|
||||||
void set_conv_handle (HANDLE h) { conv_handle.set (h); }
|
|
||||||
void reset_conv_handle () { conv_handle.set (NULL); }
|
|
||||||
void close_conv_handle () { conv_handle.close (); }
|
void close_conv_handle () { conv_handle.close (); }
|
||||||
|
|
||||||
ino_t get_ino_by_handle (HANDLE h);
|
ino_t get_ino_by_handle (HANDLE h);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user