mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
1b81bb49b4
Official docs: Some headers from C library were deprecated in C++ and are no longer welcome in C++ codebases. Some have no effect in C++. For more details refer to the C++ 14 Standard [depr.c.headers] section. This check replaces C standard library headers with their C++ alternatives and removes redundant ones.
28 lines
460 B
C++
28 lines
460 B
C++
#include <Common/IO.h>
|
|
|
|
#include <unistd.h>
|
|
#include <cerrno>
|
|
#include <cstring>
|
|
|
|
bool writeRetry(int fd, const char * data, size_t size)
|
|
{
|
|
if (!size)
|
|
size = strlen(data);
|
|
|
|
while (size != 0)
|
|
{
|
|
ssize_t res = ::write(fd, data, size);
|
|
|
|
if ((-1 == res || 0 == res) && errno != EINTR)
|
|
return false;
|
|
|
|
if (res > 0)
|
|
{
|
|
data += res;
|
|
size -= res;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|