Commit deb1f60a authored by Arnaud Blanchard's avatar Arnaud Blanchard

define BLC_LINE_MAX and replace LINE_MAX. Fix for gcc9

parent 28322b68
......@@ -6,12 +6,12 @@
This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
 users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
 In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
 that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured
 and, more generally, to use and operate it in the same conditions as regards security.
 The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
and, more generally, to use and operate it in the same conditions as regards security.
The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
Created on: Apr 28, 2011
*/
......@@ -43,6 +43,7 @@ Created on: Apr 28, 2011
#include <sys/param.h>
#include <arpa/inet.h> /* htonl, ... */
#define BLC_LINE_MAX 4096
///Shortcut to better understand arguments of a function while 0 is used for no flag
#define NO_FLAG 0
......
......@@ -6,12 +6,12 @@
This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
 users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
 In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
 that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured
 and, more generally, to use and operate it in the same conditions as regards security.
 The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. */
and, more generally, to use and operate it in the same conditions as regards security.
The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. */
//
// Created by Arnaud Blanchard on 17/06/2014.
......@@ -20,6 +20,8 @@
#include "blc_tools.h"
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
......@@ -223,7 +225,7 @@ void blc_printf_log(const char *log_name, char const *source_filename, char cons
struct timeval tv;
struct tm *tm;
time_t nowtime;
char line[LINE_MAX]; //The buffer in order to avoid concurency problem
char line[BLC_LINE_MAX]; //The buffer in order to avoid concurency problem
char filename[FILENAME_MAX];
size_t line_size;
......@@ -237,11 +239,11 @@ void blc_printf_log(const char *log_name, char const *source_filename, char cons
gettimeofday(&tv, NULL);
nowtime = tv.tv_sec;
tm = localtime(&nowtime);
line_size = strftime(line, LINE_MAX, "[%Hh%Mm%S", tm);
line_size = strftime(line, BLC_LINE_MAX, "[%Hh%Mm%S", tm);
line_size+=sprintf(line+line_size, ".%.6lds %s %s:%d]", (long)tv.tv_usec,source_filename, function ,line_id);
va_start(arguments, line_id);
format = va_arg(arguments, const char *);
line_size+=vsnprintf(line+line_size, LINE_MAX, format, arguments);
line_size+=vsnprintf(line+line_size, BLC_LINE_MAX, format, arguments);
va_end(arguments);
line[line_size]='\n';
if (fwrite(line, line_size+1, 1, blc_log_file) != 1) EXIT_ON_SYSTEM_ERROR("Writing log: %s", line);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment