Fix for ace running under Linux

Immanuel Yap noelyap at ascus.cit.cornell.edu
Wed Sep 2 17:02:40 EST 1998


ace would invariably segfault under Linux whenever it tried to call
strftime().  It appears that the function cannot handle invalid or
out-of-range values in the struct tm passed to it, even though those
values haven't been requested in the formatting string.  In the file
w1/timesubs.c,  timeStruct() does a good job of constructing a proper
struct tm; it does not, however, initialize tm_wday or tm_yday.  I have
added these lines at the end of timeStruct():

void timeStruct(struct tm *tm, mytime_t t,
                BOOL *wantMonth, BOOL *wantDay, BOOL *wantHours,
                BOOL *wantMins, BOOL *wantSecs)
{ 
  /* Most of function deleted */
  tm->tm_isdst = -1;

  /* Add the following lines to keep strftime() happy */
  tm->tm_wday = 0;
  tm->tm_yday = 0;
}

I have only tested this on my system, running Debian Linux 2.0, kernel
version 2.0.35 with libc5.4.38.
-- 
Immanuel V. Yap         e-mail: noelyap at ascus.cit.cornell.edu
Curator, RiceBlastDB            ivy1 at cornell.edu
Plant Breeding Dept.    office: (607) 255-3103
Cornell University        home: (607) 257-3463
320 Bradfield Hall
Ithaca NY 14853




More information about the Acedb mailing list