On Tue, Oct 07, 2014 at 04:09:02PM -0400, Andrew Piskorski wrote:

> C:\> C:\web\nsd-atp\bin\nsd -c
> [384.e14][-main-] Notice: nsmain: NaviServer/4.99 starting
> [384.e14][-main-] Fatal: nsthreads: localtime_s failed in ns_localtime: win32 
> err: 22

In ns_localtime(), I changed this call:
    errNum = localtime_s(&tlsPtr->ltbuf, clock); 
to instead do this:
    struct tm foo; 
    errNum = localtime_s(&foo, clock); 

And yet it still fails in exactly the same way, with EINVAL = 22.
This makes me think there is nothing wrong with the tlsPtr code or
data, rather something is seriously broken in my build.  (But I have
no idea what.)

Possibly of interest, is that _localtime64_s() fails in exactly the
same way.  _localtime32_s() apparently does not trigger EINVAL, but
instead fails on the same debug assertion, where the tm_mday value is
out of range (and most likely -1 just like before, although I did not
confirm that).

I increased my compiler warning level from /W1 to /W3, and now I see
LOTS of type warnings, e.g.:

  log.c(689) : warning C4133: 'function' : incompatible types - from 'long *' 
to 'const time_t *'
  nssock.c(377) : warning C4133: 'function' : incompatible types - from 'int *' 
to 'const char *'
  binder.c(324) : warning C4244: 'function' : conversion from 'SOCKET' to 
'int', possible loss of data
  driver.c(3888) : warning C4244: '=' : conversion from 'SOCKET' to 'int', 
possible loss of data
  driver.c(2356) : warning C4244: 'function' : conversion from 'ssize_t' to 
'unsigned int', possible loss of data
  driver.c(3475) : warning C4244: '=' : conversion from 'ssize_t' to 'off_t', 
possible loss of data
  driver.c(3351) : warning C4244: 'function' : conversion from 'Tcl_WideInt' to 
'long', possible loss of data
  driver.c(2346) : warning C4267: 'function' : conversion from 'size_t' to 
'int', possible loss of data
  driver.c(3354) : warning C4267: 'function' : conversion from 'size_t' to 
'unsigned int', possible loss of data
  tclhttp.c(371) : warning C4244: '=' : conversion from '__int64' to 'int', 
possible loss of data

That first one in log.c looks mildly suspicious.  But, on a 64-bit
machine like this "long" and "time_t" are both 64-bit integers, so I
don't see the problem.  Why are they "incompatible"?

  http://msdn.microsoft.com/en-us/library/323b6b3k%28v=vs.100%29.aspx

However, in include/nsthread.h, why is Ns_Time defined like this?:

  typedef struct Ns_Time { 
      long    sec; 
      long    usec; 
  } Ns_Time; 

Shouldn't the type of sec be time_t rather than long?

-- 
Andrew Piskorski <a...@piskorski.com>

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to