@@ -238,7 +238,7 @@ static int nested_debug = 0;
238238static void write_debug ()
239239{
240240 int x ;
241- char s [25 ];
241+ char s [26 ];
242242
243243 if (nested_debug ) {
244244 /* Yoicks, if we have this there's serious trouble!
@@ -247,7 +247,7 @@ static void write_debug()
247247 x = creat ("DEBUG.DEBUG" , 0644 );
248248 if (x >= 0 ) {
249249 setsock (x , SOCK_NONSOCK );
250- strlcpy ( s , ctime ( & now ), sizeof s );
250+ ctime_r ( & now , s );
251251 dprintf (- x , "Debug (%s) written %s\n"
252252 "Please report problem to https://github.com/eggheads/eggdrop/issues\n"
253253 "Check doc/BUG-REPORT on how to do so." , ver , s );
@@ -275,8 +275,8 @@ static void write_debug()
275275 if (x < 0 ) {
276276 putlog (LOG_MISC , "*" , "* Failed to write DEBUG" );
277277 } else {
278- strlcpy ( s , ctime ( & now ), sizeof s );
279- dprintf (- x , "Debug (%s) written %s\n " , ver , s );
278+ ctime_r ( & now , s );
279+ dprintf (- x , "Debug (%s) written %s" , ver , s );
280280#ifdef EGG_PATCH
281281 dprintf (- x , "Patch level: %s\n" , EGG_PATCH );
282282#else
@@ -575,7 +575,7 @@ static void core_secondly()
575575 }
576576 nowmins = now / 60 ;
577577 if (nowmins > lastmin ) {
578- memcpy ( & nowtm , localtime ( & now ), sizeof ( struct tm ) );
578+ localtime_r ( & now , & nowtm );
579579 i = 0 ;
580580 /* Once a minute */
581581 ++ lastmin ;
@@ -599,10 +599,11 @@ static void core_secondly()
599599 check_botnet_pings ();
600600
601601 if (!miltime ) { /* At midnight */
602- char s [25 ];
602+ char s [26 ];
603603 int j ;
604604
605- strlcpy (s , ctime (& now ), sizeof s );
605+ ctime_r (& now , s );
606+ s [24 ] = 0 ;
606607 if (quiet_save < 3 )
607608 putlog (LOG_ALL , "*" , "--- %.11s%s" , s , s + 20 );
608609 call_hook (HOOK_BACKUP );
@@ -946,7 +947,7 @@ static void init_random(void) {
946947int main (int arg_c , char * * arg_v )
947948{
948949 int i , j , xx ;
949- char s [25 ];
950+ char s [26 ];
950951 FILE * f ;
951952 struct sigaction sv ;
952953 struct chanset_t * chan ;
@@ -1068,8 +1069,8 @@ int main(int arg_c, char **arg_v)
10681069 dns_thread_head = nmalloc (sizeof (struct dns_thread_node ));
10691070 dns_thread_head -> next = NULL ;
10701071#endif
1071- strlcpy ( s , ctime ( & now ), sizeof s );
1072- memmove ( & s [ 11 ], & s [ 20 ], strlen ( & s [ 20 ]) + 1 ) ;
1072+ ctime_r ( & now , s );
1073+ s [ 24 ] = 0 ;
10731074 putlog (LOG_ALL , "*" , "--- Loading %s (%s)" , ver , s );
10741075 chanprog ();
10751076 if (!encrypt_pass2 && !encrypt_pass ) {
0 commit comments