Changeset ee6b30f
- Timestamp:
- Oct 8, 2017, 6:02:19 PM (7 years ago)
- Branches:
- master
- Children:
- 4fd3c04
- Parents:
- 09530e6
- git-author:
- Anders Kaseorg <andersk@mit.edu> (10/07/17 03:25:44)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (10/08/17 18:02:19)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
rb61ad80 ree6b30f 1226 1226 FILE *file; 1227 1227 time_t now; 1228 struct tm tm; 1228 1229 va_list ap; 1229 1230 … … 1237 1238 now = time(NULL); 1238 1239 1239 tmpbuff = owl_util_format_time(localtime (&now));1240 tmpbuff = owl_util_format_time(localtime_r(&now, &tm)); 1240 1241 fprintf(file, "[%d - %s - %lds]: ", 1241 1242 (int) getpid(), tmpbuff, now - owl_global_get_starttime(&g)); … … 1775 1776 char buff[MAXPATHLEN+1]; 1776 1777 time_t start; 1778 struct tm tm; 1777 1779 int up, days, hours, minutes; 1778 1780 owl_fmtext fm; … … 1800 1802 owl_fmtext_append_normal(&fm, "\n"); 1801 1803 1802 tmpbuff = owl_util_format_time(localtime (&start));1804 tmpbuff = owl_util_format_time(localtime_r(&start, &tm)); 1803 1805 owl_fmtext_appendf_normal(&fm, " Startup Time: %s\n", tmpbuff); 1804 1806 g_free(tmpbuff); … … 3424 3426 char *date; 3425 3427 time_t now; 3428 struct tm tm; 3426 3429 char *buff; 3427 3430 3428 3431 now = time(NULL); 3429 date = owl_util_format_time(localtime (&now));3432 date = owl_util_format_time(localtime_r(&now, &tm)); 3430 3433 3431 3434 buff = g_strdup_printf("%s %s", date, string); -
message.c
rff528e6 ree6b30f 30 30 void owl_message_init(owl_message *m) 31 31 { 32 /* ctime_r requires a 26-byte buffer */ 33 char timestr[26]; 34 32 35 m->id=owl_global_get_nextmsgid(&g); 33 36 owl_message_set_direction_none(m); … … 43 46 /* save the time */ 44 47 m->time = time(NULL); 45 m->timestr = g_strdup(ctime(&m->time));46 m->timestr [strlen(m->timestr)-1] = '\0';48 ctime_r(&m->time, timestr); 49 m->timestr = g_strndup(timestr, strlen(timestr) - 1); 47 50 48 51 m->fmtext = NULL; … … 349 352 CALLER_OWN char *owl_message_format_time(const owl_message *m) 350 353 { 351 return owl_util_format_time(localtime(&m->time)); 354 struct tm tm; 355 return owl_util_format_time(localtime_r(&m->time, &tm)); 352 356 } 353 357 … … 593 597 CALLER_OWN GList *owl_message_get_cc_without_recipient(const owl_message *m) 594 598 { 595 char *cc, *shortuser, *recip ;599 char *cc, *shortuser, *recip, *saveptr; 596 600 const char *user; 597 601 GList *out = NULL; … … 603 607 recip = short_zuser(owl_message_get_recipient(m)); 604 608 605 user = strtok (cc, " ");609 user = strtok_r(cc, " ", &saveptr); 606 610 while (user != NULL) { 607 611 shortuser = short_zuser(user); … … 610 614 } 611 615 g_free(shortuser); 612 user = strtok (NULL, " ");616 user = strtok_r(NULL, " ", &saveptr); 613 617 } 614 618 … … 775 779 struct hostent *hent; 776 780 #endif /* ZNOTICE_SOCKADDR */ 777 char *tmp, *tmp2; 781 /* ctime_r requires a 26-byte buffer */ 782 char timestr[26], *tmp, *tmp2; 778 783 int len; 779 784 … … 793 798 if (m->timestr) g_free(m->timestr); 794 799 m->time = n->z_time.tv_sec; 795 m->timestr = g_strdup(ctime(&m->time));796 m->timestr [strlen(m->timestr)-1] = '\0';800 ctime_r(&m->time, timestr); 801 m->timestr = g_strndup(timestr, strlen(timestr) - 1); 797 802 798 803 /* set other info */ -
zephyr.c
rff58239 ree6b30f 284 284 FILE *file; 285 285 int fopen_errno; 286 char *tmp, *start ;286 char *tmp, *start, *saveptr; 287 287 char *buffer = NULL; 288 288 char *subsfile; … … 319 319 320 320 /* add it to the list of subs */ 321 if ((tmp = strtok (start, ",\n\r")) == NULL)321 if ((tmp = strtok_r(start, ",\n\r", &saveptr)) == NULL) 322 322 continue; 323 323 subs[count].zsub_class = g_strdup(tmp); 324 if ((tmp =strtok(NULL, ",\n\r")) == NULL)324 if ((tmp = strtok_r(NULL, ",\n\r", &saveptr)) == NULL) 325 325 continue; 326 326 subs[count].zsub_classinst = g_strdup(tmp); 327 if ((tmp = strtok (NULL, " \t\n\r")) == NULL)327 if ((tmp = strtok_r(NULL, " \t\n\r", &saveptr)) == NULL) 328 328 continue; 329 329 subs[count].zsub_recipient = g_strdup(tmp);
Note: See TracChangeset
for help on using the changeset viewer.