void-packages/srcpkgs/atomicparsley/patches/musl-fpos_t.patch
Jürgen Buchmüller 1da28202e8 atomicparsley: fix musl patch + enable pie
nopie=yes is no longer required.
The patch for musl libc's fpos_t was wrong, because stdio.h has an opaque
definition fpos_t::__opaque and no __pos member. Rrite the file position
into the first 64 bits of the union using a *(uint64_t*) type cast.
2017-01-27 18:21:16 +01:00

30 lines
1.1 KiB
Diff

--- AtomicParsley.cpp 2017-01-27 18:09:38.871046030 +0100
+++ AtomicParsley.cpp 2017-01-27 18:10:35.548088839 +0100
@@ -4585,10 +4585,11 @@
#if defined(_MSC_VER)
fpos_t file_offset = dest_position + file_pos;
#elif defined(__GLIBC__)
- fpos_t file_offset = {0};
+ fpos_t file_offset = {0};
file_offset.__pos = dest_position + file_pos;
#else
- off_t file_offset = dest_position + file_pos;
+ fpos_t file_offset = {0};
+ *(uint64_t*) &file_offset = dest_position + file_pos;
#endif
fsetpos(dest_file, &file_offset);
fwrite(buffer, (size_t)max_buffer, 1, dest_file);
@@ -4601,10 +4601,11 @@
#if defined(_MSC_VER)
fpos_t file_offset = dest_position + file_pos;
#elif defined(__GLIBC__)
- fpos_t file_offset = {0};
+ fpos_t file_offset = {0};
file_offset.__pos = dest_position + file_pos;
#else
- off_t file_offset = dest_position + file_pos;
+ fpos_t file_offset = {0};
+ *(uint64_t*) &file_offset = dest_position + file_pos;
#endif
fsetpos(dest_file, &file_offset );
fwrite(buffer, (size_t)(src_file_size - file_pos), 1, dest_file);