summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYao Chen2018-05-22 17:57:08 -0500
committerYao Chen2018-05-22 18:06:21 -0500
commit4d1deed139bbfabd7c3078a802e5b6a69f3ed8e8 (patch)
tree7dd8b29a043c72e27ed97bdf86e17b8385c6444f /libstats
parent931a840e8c3494a4fac881c6f7b8663679ca6a88 (diff)
downloadplatform-system-core-4d1deed139bbfabd7c3078a802e5b6a69f3ed8e8.tar.gz
platform-system-core-4d1deed139bbfabd7c3078a802e5b6a69f3ed8e8.tar.xz
platform-system-core-4d1deed139bbfabd7c3078a802e5b6a69f3ed8e8.zip
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
Diffstat (limited to 'libstats')
-rw-r--r--libstats/stats_event_list.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/libstats/stats_event_list.c b/libstats/stats_event_list.c
index 966bb08a2..3d746db18 100644
--- a/libstats/stats_event_list.c
+++ b/libstats/stats_event_list.c
@@ -131,7 +131,7 @@ static int __write_to_statsd_initialize_locked() {
131} 131}
132 132
133static int __write_to_stats_daemon(struct iovec* vec, size_t nr) { 133static int __write_to_stats_daemon(struct iovec* vec, size_t nr) {
134 int ret, save_errno; 134 int save_errno;
135 struct timespec ts; 135 struct timespec ts;
136 size_t len, i; 136 size_t len, i;
137 137
@@ -145,14 +145,7 @@ static int __write_to_stats_daemon(struct iovec* vec, size_t nr) {
145 save_errno = errno; 145 save_errno = errno;
146 clock_gettime(CLOCK_REALTIME, &ts); 146 clock_gettime(CLOCK_REALTIME, &ts);
147 147
148 ret = 0; 148 int ret = (int)(*statsdLoggerWrite.write)(&ts, vec, nr);
149
150 ssize_t retval;
151 retval = (*statsdLoggerWrite.write)(&ts, vec, nr);
152 if (ret >= 0) {
153 ret = retval;
154 }
155
156 errno = save_errno; 149 errno = save_errno;
157 return ret; 150 return ret;
158} 151}
@@ -178,4 +171,4 @@ static int __write_to_statsd_init(struct iovec* vec, size_t nr) {
178 ret = write_to_statsd(vec, nr); 171 ret = write_to_statsd(vec, nr);
179 errno = save_errno; 172 errno = save_errno;
180 return ret; 173 return ret;
181} \ No newline at end of file 174}