summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarout Hedeshian <harouth@codeaurora.org>2015-07-31 13:08:06 -0600
committerHarout Hedeshian <harouth@codeaurora.org>2015-07-31 13:09:14 -0600
commit0ba209d2a5ca615ba7cc35d0a5875718a995a2a0 (patch)
tree84f4bd3ec63001350839ba9cb7083b07e925155b
parent0abce0065f60c8a4d1f445196105a2483ecbc2ef (diff)
downloadandroid_vendor_qcom_opensource_dataservices-0ba209d2a5ca615ba7cc35d0a5875718a995a2a0.tar.gz
android_vendor_qcom_opensource_dataservices-0ba209d2a5ca615ba7cc35d0a5875718a995a2a0.tar.bz2
android_vendor_qcom_opensource_dataservices-0ba209d2a5ca615ba7cc35d0a5875718a995a2a0.zip
datatop: fix file line count helper function always returns 0 lines
When porting the snapshot, a change was made to dtop_get_file_line_amount() to initialize rc to -1. glibc defines EoF as -1 thus causing the for loop to never get executed. A line count of 0 was getting returnd thus causing ~1500 data points to not get polled. Instead, initialize rc to 0. Change-Id: I8e7a93f5efd535d662c13fa81cd5d0e421ad5a6b
-rw-r--r--datatop/src/datatop_fileops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/datatop/src/datatop_fileops.c b/datatop/src/datatop_fileops.c
index 52068f5..b4c866c 100644
--- a/datatop/src/datatop_fileops.c
+++ b/datatop/src/datatop_fileops.c
@@ -153,7 +153,7 @@ void dtop_close_file(FILE *fw)
*/
int dtop_get_file_line_amount(char *name)
{
- signed char rc = -1;
+ signed char rc = 0;
int line_count = 0;
FILE *file = fopen(name, "r");
while (rc != EOF) {