Implement fhandler_dev_null::write to workaround a problem with NUL
Windows NUL device returns only the lower 32 bit of the number of bytes written. Implement a fake write function to ignore the underlying NUL device. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
a3f297d3c2
commit
dd757cc43a
winsup/cygwin
|
@ -1529,6 +1529,15 @@ fhandler_dev_null::fhandler_dev_null () :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssize_t __stdcall
|
||||||
|
fhandler_dev_null::write (const void *ptr, size_t len)
|
||||||
|
{
|
||||||
|
/* Shortcut. This also fixes a problem with the NUL device on 64 bit:
|
||||||
|
If you write > 4 GB in a single attempt, the bytes written returned
|
||||||
|
from by is numBytes & 0xffffffff. */
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_base::set_no_inheritance (HANDLE &h, bool not_inheriting)
|
fhandler_base::set_no_inheritance (HANDLE &h, bool not_inheriting)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1682,6 +1682,8 @@ class fhandler_dev_null: public fhandler_base
|
||||||
copyto (fh);
|
copyto (fh);
|
||||||
return fh;
|
return fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssize_t __stdcall write (const void *ptr, size_t len);
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_dev_zero: public fhandler_base
|
class fhandler_dev_zero: public fhandler_base
|
||||||
|
|
Loading…
Reference in New Issue