Fixes build in Windows.

This commit is contained in:
Andrea Mazzoleni 2013-10-06 17:44:55 +02:00
parent df717723ac
commit 0d3ec44803
2 changed files with 8 additions and 1 deletions

View file

@ -74,7 +74,8 @@ AC_CHECK_FUNCS([memset strchr strerror strrchr mkdir gettimeofday strtoul])
AC_CHECK_FUNCS([getopt getopt_long snprintf vsnprintf])
AC_CHECK_FUNCS([ftruncate fallocate fsync access posix_fallocate posix_fadvise])
AC_CHECK_FUNCS([pread pwrite getc_unlocked ferror_unlocked fnmatch])
AC_CHECK_FUNCS([futimes futimens futimesat fstatat flock statfs])
AC_CHECK_FUNCS([futimes futimens futimesat localtime_r])
AC_CHECK_FUNCS([fstatat flock statfs])
dnl Checks for architecture
AC_C_BIGENDIAN

6
list.c
View file

@ -48,7 +48,9 @@ void state_list(struct snapraid_state* state)
/* for each file */
for(j=disk->filelist;j!=0;j=j->next) {
struct snapraid_file* file = j->data;
#if HAVE_LOCALTIME_R
struct tm tm_res;
#endif
struct tm* tm;
time_t t;
@ -58,7 +60,11 @@ void state_list(struct snapraid_state* state)
fprintf(stdlog, "file:%s:%s:%"PRIu64":%"PRIi64":%u:%"PRIi64"\n", disk->name, file->sub, file->size, file->mtime_sec, file->mtime_nsec, file->inode);
t = file->mtime_sec;
#if HAVE_LOCALTIME_R
tm = localtime_r(&t, &tm_res);
#else
tm = localtime(&t);
#endif
printf("%12"PRIu64" ", file->size);
if (tm) {