fflush: avoid compilation error on NetBSD
authorEric Blake <ebb9@byu.net>
Mon, 14 Dec 2009 22:42:13 +0000 (15:42 -0700)
committerEric Blake <ebb9@byu.net>
Wed, 16 Dec 2009 12:59:58 +0000 (05:59 -0700)
commit4215bcc7e5202438ec9d981d1753bd442871e05a
tree6dc36ebcf1ee3c933d12d4026ca1dd12516e4dae
parentc150f13de37b0881b46da70a6977cdce3ca67922
fflush: avoid compilation error on NetBSD

On NetBSD, the system <stdio.h> header contains:
|#if (!defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)) || defined(_LIBC)
|typedef __off_t fpos_t;
|#else
|typedef struct __sfpos {
|    __off_t _pos;
|} fpos_t;
|#endif

Thus, based on compiler flags (such as using 'gcc -ansi' or the
Intel compiler), it is an error to directly set fpos_t=off_t.

* lib/fflush.c (update_fpos_cache): Use a union to safely convert
between off_t and fpos_t, since the latter is sometimes a struct.
* lib/fseeko.c (rpl_fseeko): Likewise.
Reported by Alexander Nasonov <alnsn@yandex.ru>.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/fflush.c
lib/fseeko.c