Portability: Support platforms that lack (struct stat).st_blksize or SSIZE_MAX
Of course, FreeBSD has both.
This commit is contained in:
parent
6d35d9a6e9
commit
220265229d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182954
@ -78,6 +78,9 @@
|
||||
#if !HAVE_DECL_SIZE_MAX
|
||||
#define SIZE_MAX (~(size_t)0)
|
||||
#endif
|
||||
#if !HAVE_DECL_SSIZE_MAX
|
||||
#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
|
||||
#endif
|
||||
#if !HAVE_DECL_UINT32_MAX
|
||||
#define UINT32_MAX (~(uint32_t)0)
|
||||
#endif
|
||||
|
@ -514,9 +514,15 @@ write_data_block(struct archive_write_disk *a,
|
||||
}
|
||||
|
||||
if (a->flags & ARCHIVE_EXTRACT_SPARSE) {
|
||||
#if HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK)
|
||||
return (r);
|
||||
block_size = a->pst->st_blksize;
|
||||
#else
|
||||
/* XXX TODO XXX Is there a more appropriate choice here ? */
|
||||
/* This needn't match the filesystem allocation size. */
|
||||
block_size = 16*1024;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (a->filesize >= 0 && (off_t)(offset + size) > a->filesize)
|
||||
|
@ -41,6 +41,7 @@
|
||||
#define HAVE_DECL_INT64_MAX 1
|
||||
#define HAVE_DECL_INT64_MIN 1
|
||||
#define HAVE_DECL_SIZE_MAX 1
|
||||
#define HAVE_DECL_SSIZE_MAX 1
|
||||
#define HAVE_DECL_STRERROR_R 1
|
||||
#define HAVE_DECL_UINT32_MAX 1
|
||||
#define HAVE_DECL_UINT64_MAX 1
|
||||
@ -86,6 +87,7 @@
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
|
||||
#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
|
||||
#define HAVE_SYS_ACL_H 1
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
Loading…
Reference in New Issue
Block a user