ClickHouse/src/Common/IO.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
460 B
C++
Raw Normal View History

2021-06-02 04:48:31 +00:00
#include <Common/IO.h>
#include <unistd.h>
#include <cerrno>
2021-06-02 04:48:31 +00:00
#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;
}