|
468 | 468 | int ps2link_request_readdir(void *packet) { |
469 | 469 | DIR *dir; |
470 | 470 | struct { unsigned int number; unsigned short length; int dd; } PACKED *request = packet; |
471 | | - struct dirent *dirent; struct stat stats; struct tm loctime; |
| 471 | + struct dirent *dirent; struct stat stats; struct tm *loctime; |
472 | 472 | unsigned int mode; unsigned char ctime[8]; unsigned char atime[8]; unsigned char mtime[8]; |
473 | 473 | char tname[512]; |
474 | 474 |
|
|
500 | 500 | if (S_ISREG(stats.st_mode)) { mode |= 0x10; } |
501 | 501 |
|
502 | 502 | // Convert the creation time. |
503 | | - localtime_r(&(stats.st_ctime), &loctime); |
504 | | - ctime[6] = (unsigned char)loctime.tm_year; |
505 | | - ctime[5] = (unsigned char)loctime.tm_mon + 1; |
506 | | - ctime[4] = (unsigned char)loctime.tm_mday; |
507 | | - ctime[3] = (unsigned char)loctime.tm_hour; |
508 | | - ctime[2] = (unsigned char)loctime.tm_min; |
509 | | - ctime[1] = (unsigned char)loctime.tm_sec; |
| 503 | + loctime = localtime(&(stats.st_ctime)); |
| 504 | + ctime[6] = (unsigned char)loctime->tm_year; |
| 505 | + ctime[5] = (unsigned char)loctime->tm_mon + 1; |
| 506 | + ctime[4] = (unsigned char)loctime->tm_mday; |
| 507 | + ctime[3] = (unsigned char)loctime->tm_hour; |
| 508 | + ctime[2] = (unsigned char)loctime->tm_min; |
| 509 | + ctime[1] = (unsigned char)loctime->tm_sec; |
510 | 510 |
|
511 | 511 | // Convert the access time. |
512 | | - localtime_r(&(stats.st_atime), &loctime); |
513 | | - atime[6] = (unsigned char)loctime.tm_year; |
514 | | - atime[5] = (unsigned char)loctime.tm_mon + 1; |
515 | | - atime[4] = (unsigned char)loctime.tm_mday; |
516 | | - atime[3] = (unsigned char)loctime.tm_hour; |
517 | | - atime[2] = (unsigned char)loctime.tm_min; |
518 | | - atime[1] = (unsigned char)loctime.tm_sec; |
| 512 | + loctime = localtime(&(stats.st_atime)); |
| 513 | + atime[6] = (unsigned char)loctime->tm_year; |
| 514 | + atime[5] = (unsigned char)loctime->tm_mon + 1; |
| 515 | + atime[4] = (unsigned char)loctime->tm_mday; |
| 516 | + atime[3] = (unsigned char)loctime->tm_hour; |
| 517 | + atime[2] = (unsigned char)loctime->tm_min; |
| 518 | + atime[1] = (unsigned char)loctime->tm_sec; |
519 | 519 |
|
520 | 520 | // Convert the last modified time. |
521 | | - localtime_r(&(stats.st_mtime), &loctime); |
522 | | - mtime[6] = (unsigned char)loctime.tm_year; |
523 | | - mtime[5] = (unsigned char)loctime.tm_mon + 1; |
524 | | - mtime[4] = (unsigned char)loctime.tm_mday; |
525 | | - mtime[3] = (unsigned char)loctime.tm_hour; |
526 | | - mtime[2] = (unsigned char)loctime.tm_min; |
527 | | - mtime[1] = (unsigned char)loctime.tm_sec; |
| 521 | + loctime = localtime(&(stats.st_mtime)); |
| 522 | + mtime[6] = (unsigned char)loctime->tm_year; |
| 523 | + mtime[5] = (unsigned char)loctime->tm_mon + 1; |
| 524 | + mtime[4] = (unsigned char)loctime->tm_mday; |
| 525 | + mtime[3] = (unsigned char)loctime->tm_hour; |
| 526 | + mtime[2] = (unsigned char)loctime->tm_min; |
| 527 | + mtime[1] = (unsigned char)loctime->tm_sec; |
528 | 528 |
|
529 | 529 | // Send the response. |
530 | 530 | return ps2link_response_readdir(1, mode, 0, stats.st_size, ctime, atime, mtime, 0, dirent->d_name); |
|
0 commit comments