Ignore:
Timestamp:
Dec 28, 2010, 10:47:09 AM (15 years ago)
Author:
Herwig Bauernfeind
Message:

Vitalis fix for maximum read size in NdpFileRead()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/client-2.0/src/debug.c

    r497 r507  
    3030#include <sys/stat.h>
    3131
    32 int debuglevel = 9; // we set it to 9, so we get all messages
     32int debuglevel = 1; // we set it to 9, so we get all messages
    3333char logfile[_MAX_PATH +1]  = {0};
    3434char debugfile[_MAX_PATH +1] = {0};
     
    4343BOOL writeLog()
    4444{
    45         return do_logging;
     45        return do_logging;
    4646}
    4747
    4848void debuglocal(int level, const char * fmt, ...)
    4949{
    50         FILE *f=NULL;
    51         struct stat filestat;
     50        FILE *f=NULL;
     51        struct stat filestat;
    5252
    53         // do we have to log at all
    54         if (!debuglvl(level))
     53        // do we have to log at all
     54/*      if (!debuglvl(level))
    5555        {
    5656                return;
    57         }
     57        } */
    5858
    59         // if the file ndpsmb.dbg is around we write a logfile
    60         if (!debugfile[0])
    61         {
    62            strncpy(debugfile, getenv("ETC"), 2);
    63            strncat(debugfile, "\\", sizeof(debugfile) - strlen(debugfile) -1);
    64            strncat(debugfile, "ndpsmb.dbg", sizeof(debugfile) - strlen(debugfile) -1);
    65         } /* endif */
    66        
    67         if (stat(debugfile, &filestat) !=0)
    68            return;
     59        // if the file ndpsmb.dbg is around we write a logfile
     60        if (!debugfile[0])
     61        {
     62                strncpy(debugfile, getenv("ETC"), 2);
     63                strncat(debugfile, "\\", sizeof(debugfile) - strlen(debugfile) -1);
     64                strncat(debugfile, "ndpsmb.dbg", sizeof(debugfile) - strlen(debugfile) -1);
     65        } /* endif */
     66       
     67        if (stat(debugfile, &filestat) !=0)
     68                return;
    6969
    70         //we create the logfile variable only once
    71         if (!logfile[0])
    72         {
    73                 char *env = getenv("LOGFILES");
    74                 if (env != NULL)
    75                 {
    76                    strncpy(logfile, env, sizeof(logfile) -1);
    77                    strncat(logfile, "\\", sizeof(logfile) - strlen(logfile) -1);
    78                    strncat(logfile, logfilename, sizeof(logfile) - strlen(logfile) -1);
    79                 }
    80                 else
    81                 {
    82                    strncpy(logfile, logfilename, sizeof(logfile) -1);
    83                 }
    84                 // set the samba logging stuff
    85                 do_logging = TRUE;
    86         } /* endif */
     70        //we create the logfile variable only once
     71        if (!logfile[0])
     72        {
     73                char *env = getenv("LOGFILES");
     74                if (env != NULL)
     75                {
     76                        strncpy(logfile, env, sizeof(logfile) -1);
     77                        strncat(logfile, "\\", sizeof(logfile) - strlen(logfile) -1);
     78                        strncat(logfile, logfilename, sizeof(logfile) - strlen(logfile) -1);
     79                }
     80                else
     81                {
     82                        strncpy(logfile, logfilename, sizeof(logfile) -1);
     83                }
     84                // set the samba logging stuff
     85                do_logging = TRUE;
     86        } /* endif */
    8787
    8888        do
Note: See TracChangeset for help on using the changeset viewer.