b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | --- a/bzip2.c |
| 2 | +++ b/bzip2.c |
| 3 | @@ -69,7 +69,6 @@ |
| 4 | #if BZ_UNIX |
| 5 | # include <fcntl.h> |
| 6 | # include <sys/types.h> |
| 7 | -# include <utime.h> |
| 8 | # include <unistd.h> |
| 9 | # include <sys/stat.h> |
| 10 | # include <sys/times.h> |
| 11 | @@ -1051,12 +1050,12 @@ void applySavedTimeInfoToOutputFile ( Ch |
| 12 | { |
| 13 | # if BZ_UNIX |
| 14 | IntNative retVal; |
| 15 | - struct utimbuf uTimBuf; |
| 16 | + struct timespec uTimBuf[2] = {}; |
| 17 | |
| 18 | - uTimBuf.actime = fileMetaInfo.st_atime; |
| 19 | - uTimBuf.modtime = fileMetaInfo.st_mtime; |
| 20 | + uTimBuf[0].tv_sec = fileMetaInfo.st_atime; |
| 21 | + uTimBuf[1].tv_sec = fileMetaInfo.st_mtime; |
| 22 | |
| 23 | - retVal = utime ( dstName, &uTimBuf ); |
| 24 | + retVal = utimensat ( AT_FDCWD, dstName, uTimBuf , 0 ); |
| 25 | ERROR_IF_NOT_ZERO ( retVal ); |
| 26 | # endif |
| 27 | } |