Patches item #548448, was opened at 2002-04-25 08:27
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=304593&aid=548448&group_id=4593

Category: stable
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Martin Vorlaender (martinv2)
Assigned to: Nobody/Anonymous (nobody)
Summary: Cope with unsigned time_t type

Initial Comment:
While porting ht://Dig to OpenVMS/Alpha, I saw a program hang 
due to the fact that the time arithmetic in 
htdig/server.cc:Server::delay overflows if time_t is an unsigned 
type (which is the case in Compaq C++). To remedy it, just 
rearrange the calculation:

diff -cdrN orig/htdig/server.cc 
vms/htdig/server.cc
*** orig/htdig/server.cc        Thu Jan 31 
23:47:16 2002
--- vms/htdig/server.cc         Thu Oct  4 18:17:02 
2001
***************
*** 287,296 ****
  void 
Server::delay()
  {
    time_t now = time(0);
!   time_t 
how_long = _connection_space + _last_connection - now;
!   
_last_connection = now;  // Reset the clock for the next delay!
!   if 
(how_long > 0)
      sleep(how_long);
    return;
  }
  
--- 
287,298 ----
  void Server::delay()
  {
    time_t now = 
time(0);
!   if (_connection_space > now - _last_connection)
!   
{
!     time_t how_long = _connection_space - (now - 
_last_connection);
      sleep(how_long);
+   }
+   
_last_connection = now;  // Reset the clock for the next delay!
    
return;
  }


Some other issues in the port (more VMS 
specific):
- file handling in htcommon/wordlist.cc: changed to 
only open the wordlist file once.
- externalparser.cc: no fork() on 
VMS - used the 3.1.5 code
- system() calls for sorting: replaced 
by system API
- filenames may only contain one dot: changed 
to use underscore
- CGI variables: added support for WWW_* 
variants (still used by some VMS 
webservers)


Anyway: the port was comparably easy. 
What a great piece of software! Thanks.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=304593&aid=548448&group_id=4593

_______________________________________________
htdig-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/htdig-dev

Reply via email to