void Pipe::set_block(bool b)
{
adjust_mode(mode, M_NONBLOCK, !b);
- sys_set_blocking(read_handle, b);
- sys_set_blocking(write_handle, b);
+ if(read_handle)
+ sys_set_blocking(read_handle, b);
+ if(write_handle)
+ sys_set_blocking(write_handle, b);
}
void Pipe::set_inherit(bool i)
{
adjust_mode(mode, M_INHERIT, i);
- sys_set_inherit(read_handle, i);
- sys_set_inherit(write_handle, i);
+ if(read_handle)
+ sys_set_inherit(read_handle, i);
+ if(write_handle)
+ sys_set_inherit(write_handle, i);
}
size_t Pipe::do_write(const char *buf, size_t size)