Cygwin: check path_conv_handle for NULL before trying to dup it
path_conv_handle::dup calls DuplicateHandle unconditionally, but we only have a handle in some cases. Check handle for being non-NULL before calling DuplicateHandle. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
5f0913df13
commit
d0e0a59e78
|
@ -105,9 +105,10 @@ public:
|
||||||
}
|
}
|
||||||
inline void dup (const path_conv_handle &pch)
|
inline void dup (const path_conv_handle &pch)
|
||||||
{
|
{
|
||||||
if (!DuplicateHandle (GetCurrentProcess (), pch.handle (),
|
if (pch.handle ()
|
||||||
GetCurrentProcess (), &hdl,
|
&& !DuplicateHandle (GetCurrentProcess (), pch.handle (),
|
||||||
0, TRUE, DUPLICATE_SAME_ACCESS))
|
GetCurrentProcess (), &hdl,
|
||||||
|
0, TRUE, DUPLICATE_SAME_ACCESS))
|
||||||
hdl = NULL;
|
hdl = NULL;
|
||||||
}
|
}
|
||||||
inline HANDLE handle () const { return hdl; }
|
inline HANDLE handle () const { return hdl; }
|
||||||
|
|
Loading…
Reference in New Issue