This patch fixes a bug which causes sftpd to hang whenever the clock() function returns -1 (typically caused by system uptime greater than 248 days). To apply this patch, download this page to a file called entropy-patch.txt, then: % cd sftpd-1.46 % patch < entropy-patch.txt % make (then copy 'sftpd' to wherever it's currently installed) *** entropy.cpp.prev Tue Apr 23 17:40:31 2002 --- entropy.cpp Tue Apr 23 17:43:43 2002 *************** *** 125,131 **** // get some entropy from process scheduler unsigned long i=0; clock_t clk = clock(); ! while (clk == clock()) i++; s.clks = i; long ret = crc32(buffer, sizeof(buffer)); --- 125,139 ---- // get some entropy from process scheduler unsigned long i=0; clock_t clk = clock(); ! if (clk == (clock_t)(-1)) { ! // clock() doesn't want to give useful info.. ! // let's try something else ! s.clks = (clock_t)getMilliseconds(); ! } ! else { ! // count how many iterations it takes for a change.. ! while (clk == clock()) i++; ! } s.clks = i; long ret = crc32(buffer, sizeof(buffer));