diff options
author | kientzle <kientzle@FreeBSD.org> | 2008-09-12 04:08:11 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2008-09-12 04:08:11 +0000 |
commit | ccdf5b420c98da86504569985859e9c0c043f4bf (patch) | |
tree | 8a87de07a054bab4ad94fcb7eb6668f06b8b38dd /lib | |
parent | 96223dee1179512c6e0474eda5991e0dd7a4df20 (diff) | |
download | FreeBSD-src-ccdf5b420c98da86504569985859e9c0c043f4bf.zip FreeBSD-src-ccdf5b420c98da86504569985859e9c0c043f4bf.tar.gz |
Portability: Not everyone is lucky enough to have ftruncate()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libarchive/archive_write_disk.c | 2 | ||||
-rw-r--r-- | lib/libarchive/config_freebsd.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/libarchive/archive_write_disk.c b/lib/libarchive/archive_write_disk.c index f0bec6e..8b364f2 100644 --- a/lib/libarchive/archive_write_disk.c +++ b/lib/libarchive/archive_write_disk.c @@ -637,12 +637,14 @@ _archive_write_finish_entry(struct archive *_a) /* Last write ended at exactly the filesize; we're done. */ /* Hopefully, this is the common case. */ } else { +#if HAVE_FTRUNCATE if (ftruncate(a->fd, a->filesize) == -1 && a->filesize == 0) { archive_set_error(&a->archive, errno, "File size could not be restored"); return (ARCHIVE_FAILED); } +#endif /* * Explicitly stat the file as some platforms might not * implement the XSI option to extend files via ftruncate. diff --git a/lib/libarchive/config_freebsd.h b/lib/libarchive/config_freebsd.h index a8ea8b4..4c97bb2 100644 --- a/lib/libarchive/config_freebsd.h +++ b/lib/libarchive/config_freebsd.h @@ -56,6 +56,7 @@ #define HAVE_FCNTL_H 1 #define HAVE_FSEEKO 1 #define HAVE_FSTAT 1 +#define HAVE_FTRUNCATE 1 #define HAVE_FUTIMES 1 #define HAVE_GETEUID 1 #define HAVE_GETPID 1 |