1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-07 06:23:00 +03:00

Formatting and Clean Up

This commit is contained in:
W. Felix Handte
2019-09-12 16:27:05 -04:00
parent 5a9baae9cf
commit e1ec8004cc

View File

@@ -54,22 +54,24 @@ int UTIL_getFileStat(const char* infilename, stat_t *statbuf)
int UTIL_setFileStat(const char *filename, stat_t *statbuf) int UTIL_setFileStat(const char *filename, stat_t *statbuf)
{ {
int res = 0; int res = 0;
#if defined(_WIN32) || (PLATFORM_POSIX_VERSION < 200809L)
struct utimbuf timebuf;
#else
/* (atime, mtime) */
struct timespec timebuf[2] = { {0, UTIME_NOW}, statbuf->st_mtim };
#endif
if (!UTIL_isRegularFile(filename)) if (!UTIL_isRegularFile(filename))
return -1; return -1;
/* set access and modification times */
#if defined(_WIN32) || (PLATFORM_POSIX_VERSION < 200809L) #if defined(_WIN32) || (PLATFORM_POSIX_VERSION < 200809L)
timebuf.actime = time(NULL); {
timebuf.modtime = statbuf->st_mtime; struct utimbuf timebuf;
res += utime(filename, &timebuf); /* set access and modification times */ timebuf.actime = time(NULL);
timebuf.modtime = statbuf->st_mtime;
res += utime(filename, &timebuf);
}
#else #else
res += utimensat(AT_FDCWD, filename, timebuf, 0); /* set access and modification times */ {
/* (atime, mtime) */
struct timespec timebuf[2] = { {0, UTIME_NOW}, statbuf->st_mtim };
res += utimensat(AT_FDCWD, filename, timebuf, 0);
}
#endif #endif
#if !defined(_WIN32) #if !defined(_WIN32)