+2009-12-16  Eric Blake  <ebb9@byu.net>
+
+       fflush: avoid compilation error on NetBSD
+       * 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>.
+
 2009-12-15  Eric Blake  <ebb9@byu.net>
 
        fcntl-h, stdio, sys_ioctl: fix declarations
 
 update_fpos_cache (FILE *fp, off_t pos)
 {
 #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
-  fp_->_offset = pos;
+  /* Use a union, since on NetBSD, the compilation flags determine
+     whether fpos_t is typedef'd to off_t or a struct containing a
+     single off_t member.  */
+  union
+    {
+      fpos_t f;
+      off_t o;
+    } u;
+  u.o = pos;
+  fp_->_offset = u.f;
   fp_->_flags |= __SOFF;
 #endif
 }
 
 #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
       fp->_flags &= ~_IO_EOF_SEEN;
 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
-      fp_->_offset = pos;
+      {
+        /* Use a union, since on NetBSD, the compilation flags
+           determine whether fpos_t is typedef'd to off_t or a struct
+           containing a single off_t member.  */
+        union
+          {
+            fpos_t f;
+            off_t o;
+          } u;
+        u.o = pos;
+        fp_->_offset = u.f;
+      }
       fp_->_flags |= __SOFF;
       fp_->_flags &= ~__SEOF;
 #elif defined __EMX__               /* emx+gcc */