X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=daemon.c;h=c855daa19e194ee5d6e432f89771b907bd909340;hp=ae183d8edad65b0d20fdd7cc2fa4c332d8401564;hb=a4eb244ecdf9aaa0f167b3c91d3e276bde99d681;hpb=1f132af229ff899aae357ee75a3b8e7b4bd061bd diff --git a/daemon.c b/daemon.c index ae183d8e..c855daa1 100644 --- a/daemon.c +++ b/daemon.c @@ -5,12 +5,14 @@ */ /** \file daemon.c Some helpers for programs that detach from the console. */ -#include "para.h" -#include "daemon.h" + +#include #include #include /* getgrnam() */ #include +#include "para.h" +#include "daemon.h" #include "string.h" #include "color.h" @@ -331,7 +333,7 @@ __printf_2_3 void para_log(int ll, const char* fmt,...) FILE *fp; struct tm *tm; time_t t1; - char *color, str[MAXLINE] = ""; + char *color; ll = PARA_MIN(ll, NUM_LOGLEVELS - 1); ll = PARA_MAX(ll, LL_DEBUG); @@ -342,11 +344,11 @@ __printf_2_3 void para_log(int ll, const char* fmt,...) color = daemon_test_flag(DF_COLOR_LOG)? me->log_colors[ll] : NULL; if (color) fprintf(fp, "%s", color); - if (daemon_test_flag(DF_LOG_TIME)) { - /* date and time */ + if (daemon_test_flag(DF_LOG_TIME)) { /* print date and time */ + char str[100]; time(&t1); tm = localtime(&t1); - strftime(str, MAXLINE, "%b %d %H:%M:%S", tm); + strftime(str, sizeof(str), "%b %d %H:%M:%S", tm); fprintf(fp, "%s ", str); } if (daemon_test_flag(DF_LOG_HOSTNAME)) {