diff --git a/configure.ac b/configure.ac index 7bac5ab7..b8ff405b 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_TIME AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h limits.h]) -AC_CHECK_HEADERS([sys/time.h unistd.h getopt.h fnmatch.h io.h]) +AC_CHECK_HEADERS([sys/time.h unistd.h getopt.h fnmatch.h io.h inttypes.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git a/handle.c b/handle.c index 1b5d3ef6..68822eb8 100644 --- a/handle.c +++ b/handle.c @@ -166,7 +166,7 @@ int handle_create(struct snapraid_handle* handle, struct snapraid_file* file) /* return the warning condition of a larger file */ if (handle->st.st_size > file->size) { - fprintf(stderr, "File '%s' truncated to size %llu.\n", handle->path, file->size); + fprintf(stderr, "File '%s' truncated to size %"PRIu64".\n", handle->path, file->size); return 1; } diff --git a/parity.c b/parity.c index 0cf7e92b..45af8280 100644 --- a/parity.c +++ b/parity.c @@ -78,16 +78,16 @@ int parity_create(const char* path, data_off_t size) #endif if (ret != 0) { if (errno == ENOSPC) { - fprintf(stderr, "Failed to grow parity file '%s' to size %llu due lack of space.\n", path, size); + fprintf(stderr, "Failed to grow parity file '%s' to size %"PRIu64" due lack of space.\n", path, size); } else { - fprintf(stderr, "Error growing parity file '%s' to size %llu. Do you have enough space? %s.\n", path, size, strerror(errno)); + fprintf(stderr, "Error growing parity file '%s' to size %"PRIu64". Do you have enough space? %s.\n", path, size, strerror(errno)); } goto bail; } } else if (st.st_size > size) { ret = ftruncate(f, size); if (ret != 0) { - fprintf(stderr, "Error truncating parity file '%s' to size %llu. %s.\n", path, size, strerror(errno)); + fprintf(stderr, "Error truncating parity file '%s' to size %"PRIu64". %s.\n", path, size, strerror(errno)); goto bail; } } diff --git a/portable.h b/portable.h index 44428a68..dd89ffe6 100644 --- a/portable.h +++ b/portable.h @@ -46,6 +46,10 @@ #include #endif +#if HAVE_INTTYPES_H +#include +#endif + #if HAVE_UNISTD_H #include #endif diff --git a/scan.c b/scan.c index df5d65a6..047fcfa5 100644 --- a/scan.c +++ b/scan.c @@ -128,7 +128,7 @@ static void scan_file(struct snapraid_scan* scan, struct snapraid_state* state, printf("warning: Ignored hardlink '/%s'\n", sub); return; } else { - fprintf(stderr, "Internal inode '%llu' inconsistency for file '%s'\n", inode, sub); + fprintf(stderr, "Internal inode '%"PRIu64"' inconsistency for file '%s'\n", inode, sub); exit(EXIT_FAILURE); } } diff --git a/speed.c b/speed.c index a098ed5f..13bbfa65 100644 --- a/speed.c +++ b/speed.c @@ -85,7 +85,7 @@ void speed(void) } } SPEED_STOP - printf("memset %llu [MB/s]\n", ds / dt); + printf("memset %"PRIu64" [MB/s]\n", ds / dt); SPEED_START { for(j=0;jmtime; inode = file->inode, - ret = fprintf(f,"file %s %llu %llu %llu %s\n", disk->name, size, mtime, inode, file->sub); + ret = fprintf(f,"file %s %"PRIu64" %"PRIu64" %"PRIu64" %s\n", disk->name, size, mtime, inode, file->sub); if (ret < 0) { fprintf(stderr, "Error writing the content file '%s' in fprintf(). %s.\n", tmp, strerror(errno)); exit(EXIT_FAILURE);