@@ -254,7 +254,7 @@ static int nested_debug = 0;
254254static void write_debug ()
255255{
256256 int x ;
257- char s [25 ];
257+ char s [26 ];
258258 int y ;
259259
260260 if (nested_debug ) {
@@ -267,8 +267,8 @@ static void write_debug()
267267 x = creat ("DEBUG.DEBUG" , 0644 );
268268 if (x >= 0 ) {
269269 setsock (x , SOCK_NONSOCK );
270- strlcpy ( s , ctime ( & now ), sizeof s );
271- dprintf (- x , "Debug (%s) written %s\n " , ver , s );
270+ ctime_r ( & now , s );
271+ dprintf (- x , "Debug (%s) written %s" , ver , s );
272272 dprintf (- x , "Please report problem to https://github.com/eggheads/eggdrop/issues\n" );
273273#ifdef EGG_PATCH
274274 dprintf (- x , "Patch level: %s\n" , EGG_PATCH );
@@ -297,8 +297,8 @@ static void write_debug()
297297 if (x < 0 ) {
298298 putlog (LOG_MISC , "*" , "* Failed to write DEBUG" );
299299 } else {
300- strlcpy ( s , ctime ( & now ), sizeof s );
301- dprintf (- x , "Debug (%s) written %s\n " , ver , s );
300+ ctime_r ( & now , s );
301+ dprintf (- x , "Debug (%s) written %s" , ver , s );
302302#ifdef EGG_PATCH
303303 dprintf (- x , "Patch level: %s\n" , EGG_PATCH );
304304#else
@@ -633,7 +633,7 @@ static void core_secondly()
633633 }
634634 nowmins = time (NULL ) / 60 ;
635635 if (nowmins > lastmin ) {
636- memcpy ( & nowtm , localtime ( & now ), sizeof ( struct tm ) );
636+ localtime_r ( & now , & nowtm );
637637 i = 0 ;
638638
639639 /* Once a minute */
@@ -661,10 +661,11 @@ static void core_secondly()
661661 check_logsize ();
662662 }
663663 if (!miltime ) { /* At midnight */
664- char s [25 ];
664+ char s [26 ];
665665 int j ;
666666
667- strlcpy (s , ctime (& now ), sizeof s );
667+ ctime_r (& now , s );
668+ s [24 ] = 0 ;
668669 if (quiet_save < 3 )
669670 putlog (LOG_ALL , "*" , "--- %.11s%s" , s , s + 20 );
670671 call_hook (HOOK_BACKUP );
@@ -1002,7 +1003,7 @@ static void init_random(void) {
10021003int main (int arg_c , char * * arg_v )
10031004{
10041005 int i , xx ;
1005- char s [25 ];
1006+ char s [26 ];
10061007 FILE * f ;
10071008 struct sigaction sv ;
10081009 struct chanset_t * chan ;
@@ -1124,8 +1125,8 @@ int main(int arg_c, char **arg_v)
11241125 dns_thread_head = nmalloc (sizeof (struct dns_thread_node ));
11251126 dns_thread_head -> next = NULL ;
11261127#endif
1127- strlcpy ( s , ctime ( & now ), sizeof s );
1128- memmove ( & s [ 11 ], & s [ 20 ], strlen ( & s [ 20 ]) + 1 ) ;
1128+ ctime_r ( & now , s );
1129+ s [ 24 ] = 0 ;
11291130 putlog (LOG_ALL , "*" , "--- Loading %s (%s)" , ver , s );
11301131 chanprog ();
11311132 if (!encrypt_pass2 && !encrypt_pass ) {
0 commit comments