liblog: deal with restart of logd
- API change, return -errno on failure for log writing
- ENOTCONN results in a reconnection and a retry of the write
Change-Id: Ib0a90b730edeaa7e3a3c9797e4e1b0c81b6adb0a
diff --git a/liblog/logd_write_kern.c b/liblog/logd_write_kern.c
index 32a202b..5ef349b 100644
--- a/liblog/logd_write_kern.c
+++ b/liblog/logd_write_kern.c
@@ -95,12 +95,15 @@
if (/*(int)log_id >= 0 &&*/ (int)log_id < (int)LOG_ID_MAX) {
log_fd = log_fds[(int)log_id];
} else {
- return EBADF;
+ return -EBADF;
}
do {
ret = log_writev(log_fd, vec, nr);
- } while (ret < 0 && errno == EINTR);
+ if (ret < 0) {
+ ret = -errno;
+ }
+ } while (ret == -EINTR);
return ret;
}