Get rid of write_safe

Current glibc implementation is safe. Kernel does this atomically,
and write is actually implemented through writev. So if write is
async-signal-safe, than writev pretty much must be too.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2014-01-28 19:07:12 -05:00
parent 7b36bf82c4
commit 87b0284327
3 changed files with 7 additions and 25 deletions
-18
View File
@@ -6093,24 +6093,6 @@ int getpeersec(int fd, char **ret) {
return 0;
}
int writev_safe(int fd, const struct iovec *w, int j) {
for (int i = 0; i < j; i++) {
size_t written = 0;
while (written < w[i].iov_len) {
ssize_t r;
r = write(fd, (char*) w[i].iov_base + written, w[i].iov_len - written);
if (r < 0 && errno != -EINTR)
return -errno;
written += r;
}
}
return 0;
}
int mkostemp_safe(char *pattern, int flags) {
unsigned long tries = TMP_MAX;
char *s;