Remove a redundant check in statsd socket code.
The original liblog code has this additional check because there may be multiple writers registered,
there is a for-loop and the retVal is set to be the FIRST error. Statsd doesn't need it because it
only has one writer.
Test: locally tested.
Change-Id: I03f0015d0c29eba19eb2b5ea145380cb98fb2509
diff --git a/libstats/stats_event_list.c b/libstats/stats_event_list.c
index 966bb08..3d746db 100644
--- a/libstats/stats_event_list.c
+++ b/libstats/stats_event_list.c
@@ -131,7 +131,7 @@
}
static int __write_to_stats_daemon(struct iovec* vec, size_t nr) {
- int ret, save_errno;
+ int save_errno;
struct timespec ts;
size_t len, i;
@@ -145,14 +145,7 @@
save_errno = errno;
clock_gettime(CLOCK_REALTIME, &ts);
- ret = 0;
-
- ssize_t retval;
- retval = (*statsdLoggerWrite.write)(&ts, vec, nr);
- if (ret >= 0) {
- ret = retval;
- }
-
+ int ret = (int)(*statsdLoggerWrite.write)(&ts, vec, nr);
errno = save_errno;
return ret;
}
@@ -178,4 +171,4 @@
ret = write_to_statsd(vec, nr);
errno = save_errno;
return ret;
-}
\ No newline at end of file
+}