From 4c8d43322e89b87288fb5ba12e523237e620481b Mon Sep 17 00:00:00 2001 From: Lutz Helwing Date: Tue, 22 Sep 2015 10:49:29 +0200 Subject: Fixed whitespace and formatting of new code Fixed licence headers Signed-off-by: Alexander Wenzel --- src/console/dlt-logstorage-ctrl.c | 28 +++++++++++++++++----------- src/console/dlt-receive.c | 16 ++++++++++------ 2 files changed, 27 insertions(+), 17 deletions(-) (limited to 'src/console') diff --git a/src/console/dlt-logstorage-ctrl.c b/src/console/dlt-logstorage-ctrl.c index 4e34c6f..24742f0 100644 --- a/src/console/dlt-logstorage-ctrl.c +++ b/src/console/dlt-logstorage-ctrl.c @@ -1,25 +1,31 @@ -/** +/* * @licence app begin@ + * SPDX license identifier: MPL-2.0 + * * Copyright (C) 2013 - 2015 Advanced Driver Information Technology. * This code is developed by Advanced Driver Information Technology. - * Copyright of Advanced Driver Information Technology, Bosch and DENSO. - * - * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps. + * Copyright of Advanced Driver Information Technology, Bosch and DENSO * + * This file is part of GENIVI Project DLT - Diagnostic Log and Trace. * - * \copyright * This Source Code Form is subject to the terms of the - * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with - * this file, You can obtain one at http://mozilla.org/MPL/2.0/. - * + * Mozilla Public License (MPL), v. 2.0. + * If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. * + * For further information see http://www.genivi.org/. + * @licence end@ + */ + +/*! * \author Syed Hameed ADIT 2013 - 2015 * \author Christoph Lipka ADIT 2015 * + * \copyright Copyright © 2013-2015 Advanced Driver Information Technology. \n + * License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/. + * * \file dlt-logstorage-ctrl.c - * For further information see http://www.genivi.org/. - * @licence end@ - */ +*/ /******************************************************************************* ** ** diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c index 071c1ba..99268e5 100644 --- a/src/console/dlt-receive.c +++ b/src/console/dlt-receive.c @@ -493,14 +493,14 @@ int main(int argc, char* argv[]) { if (dltdata.climit > -1) { - char tmp[256]; - snprintf(tmp, 256, "Using file size limit of %li bytes\n", dltdata.climit); - dlt_log(LOG_INFO, tmp); - dltdata.ohandle = dlt_receive_open_output_file(&dltdata); + char tmp[256]; + snprintf(tmp, 256, "Using file size limit of %li bytes\n", dltdata.climit); + dlt_log(LOG_INFO, tmp); + dltdata.ohandle = dlt_receive_open_output_file(&dltdata); } else /* in case no limit for the output file is given, we simply overwrite any existing file */ { - dltdata.ohandle = open(dltdata.ovalue, O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + dltdata.ohandle = open(dltdata.ovalue, O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); } if (dltdata.ohandle == -1) @@ -612,17 +612,21 @@ int dlt_receive_message_callback(DltMessage *message, void *data) if (dltdata->climit > -1) { int bytes_to_write = message->headersize + message->datasize; + if ((bytes_to_write + dltdata->totalbytes > dltdata->climit)) { - dlt_receive_close_output_file(dltdata); + dlt_receive_close_output_file(dltdata); + if (dlt_receive_open_output_file(dltdata) < 0) { printf("ERROR: dlt_receive_message_callback: Unable to open log when maximum filesize was reached!\n"); return -1; } + dltdata->totalbytes = 0; } } + bytes_written = writev(dltdata->ohandle, iov, 2); dltdata->totalbytes += bytes_written; -- cgit v1.2.1