From e389a29bf810c76e64cb0c1b185a01dc21ebe00d Mon Sep 17 00:00:00 2001 From: Subhani Shaik Date: Sat, 15 Feb 2014 19:58:33 -0800 Subject: Fix cnss-diag for file based logging. cnss-diag broke the file based logging where the right pointer to the buff was not passed causing invalid log messages. Change-Id: Ia4581440bc84dd0a484c2b7d31455fa8d5ee831e CRs-fixed: 616488 --- tools/fwdebuglog/cld-fwlog-netlink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/fwdebuglog/cld-fwlog-netlink.c b/tools/fwdebuglog/cld-fwlog-netlink.c index 1fbd9789723a..1114d42747b5 100644 --- a/tools/fwdebuglog/cld-fwlog-netlink.c +++ b/tools/fwdebuglog/cld-fwlog-netlink.c @@ -252,7 +252,7 @@ static void stop(int signum) int main(int argc, char *argv[]) { - int res =0; + unsigned int res =0; unsigned char *eventbuf; unsigned char *dbgbuf; int c, rc = 0; @@ -409,7 +409,7 @@ int main(int argc, char *argv[]) continue; } slot = (struct dbglog_slot *)dbgbuf; - timestamp = get_le32((unsigned char *)&slot->length); + timestamp = get_le32((unsigned char *)&slot->timestamp); length = get_le32((unsigned char *)&slot->length); dropped = get_le32((unsigned char *)&slot->dropped); if (!((optionflag & SILENT_FLAG) == SILENT_FLAG)) { @@ -418,7 +418,9 @@ int main(int argc, char *argv[]) timestamp, length, dropped); } fseek(log_out, record * RECLEN, SEEK_SET); - if ((res = fwrite(dbgbuf, RECLEN, 1, log_out)) != 1){ + /* Diag type is not required so +4 */ + if ((res = fwrite((dbgbuf+sizeof(slot->diag_type)), RECLEN, + 1, log_out)) != 1){ perror("fwrite"); break; } -- cgit v1.2.3