Changeset 188 for branches/client-1.5


Ignore:
Timestamp:
May 5, 2009, 7:32:24 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Fix for Ticket #88

Location:
branches/client-1.5/src
Files:
2 edited

Legend:

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

    r151 r188  
    22   Netdrive Samba client plugin
    33   logging functions
    4    Copyright (C) netlabs.org 2003-2008
     4   Copyright (C) netlabs.org 2003-2009
    55
    66   This program is free software; you can redistribute it and/or modify
     
    2727#include <string.h>
    2828#include <sys/types.h>
    29 #include <process.h>
    3029#include <sys/time.h>
    3130
    32 #include "smbwrp.h"
    33 //#include "smbcd.h"
    34 //#include "config.h"
    35 
    36 #define SMBCD_MAX_THREADS 250
     31// #include "smbwrp.h"
    3732
    3833int debuglevel = 0;
    39 HMTX logmutex = 0;
    4034char *logfile = NULL;
    4135
    4236
    43 #if 0
    44 int debug_parse_levels(const char *params_str)
     37void dbgfileinit(char *file, int loglevel)
    4538{
    46         return 1;
     39        logfile = file;
     40        debuglevel = loglevel;
    4741}
    48 
    49 void dbgflush( void )
    50 {
    51 //      if (!logfile) fflush(stdout);
    52 }
    53 #endif
    5442
    5543int debuglvl(int level)
     
    6149{
    6250        int rc;
    63         if (level > debuglevel)
    64         {
    65                 return 0;
    66         }
    67         rc = DosRequestMutexSem(logmutex, -1L);
    68         if (rc)
     51        if (!debuglvl(level))
    6952        {
    7053                return 0;
     
    9275                gettimeofday(&tv, NULL);
    9376                t = time(NULL);
    94 //              strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime((time_t *)&tv.tv_sec));
    9577                strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime(&t));
    9678                fprintf(f, "%s.%d: %d %d: %s:%s(%d) :", buf, tv.tv_usec / 10000, level, (long)_gettid(), file, func, line);
     
    10183        }
    10284        while (0);
    103         DosReleaseMutexSem(logmutex);
    10485        return rc;
    10586}
     
    10788int debugmessage(char * fmt, ...)
    10889{
    109         int rc;
    110         rc = DosRequestMutexSem(logmutex, -1L);
    111         if (rc)
    112         {
    113                 return 0;
    114         }
    11590        do
    11691        {
     
    138113        }
    139114        while (0);
    140         DosReleaseMutexSem(logmutex);
    141115        return 0;
    142116}
     
    144118void debuglocal(int level, const char * fmt, ...)
    145119{
    146         int rc;
    147         if (level > debuglevel)
    148         {
    149                 return;
    150         }
    151         rc = DosRequestMutexSem(logmutex, -1L);
    152         if (rc)
     120
     121        if (!debuglvl(level))
    153122        {
    154123                return;
     
    184153        }
    185154        while (0);
    186         DosReleaseMutexSem(logmutex);
    187155}
    188 
    189 
  • branches/client-1.5/src/ndpsmb.c

    r183 r188  
    503503        {
    504504                StrNCpy(pRes->logfile, q, sizeof(pRes->logfile) - 1);
    505         }
     505        }
    506506
    507507        t = 0;
     
    560560        }
    561561#endif
     562
     563        // init the debug part
     564        dbgfileinit(&pRes->logfile, pRes->loglevel);
    562565
    563566        return rc;
     
    21292132}
    21302133
     2134
Note: See TracChangeset for help on using the changeset viewer.