1 --- tar-1.15.1/src/system.c.vfatTruncate 2004-09-06 07:31:00.000000000 -0400
2 +++ tar-1.15.1/src/system.c 2006-02-03 14:40:51.000000000 -0500
8 off_t pos = lseek (fd, (off_t) 0, SEEK_CUR);
9 - return pos < 0 ? -1 : ftruncate (fd, pos);
14 + if ( ftruncate(fd, pos) && errno == EPERM ) {
15 + /* wrapper around ftruncate:
16 + * ftruncate may fail to grow the size of a file with some OS and filesystem
17 + * combinations. Linux and vfat/fat is one example. If this is the case do
18 + * a write to grow the file to the desired length.
20 + if( (fstat( fd, &st ) == -1) ||
21 + (st.st_size >= pos) ||
22 + (lseek( fd, pos - 1, SEEK_SET) == (off_t)-1) ||
23 + (write( fd, "\0", 1) == -1) )
29 /* Return nonzero if NAME is the name of a regular file, or if the file