Update src/misc/helpers.cpp
parent
f510f2b8cc
commit
7a816d5920
|
@ -136,4 +136,19 @@ std::string get_absolute_path(const std::string &relative_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::string(resolved_path);
|
return std::string(resolved_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ssize_t write_all(int fd, const void *buf, size_t count) {
|
||||||
|
const char *p = (const char *)buf;
|
||||||
|
while (count > 0) {
|
||||||
|
ssize_t written = write(fd, p, count);
|
||||||
|
if (written == -1) {
|
||||||
|
if (errno == EINTR || errno == EAGAIN) continue; // Retry
|
||||||
|
return -1; // Other errors
|
||||||
|
}
|
||||||
|
count -= written;
|
||||||
|
p += written;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue