From c143b9a0ab2f6fd48bb46932329766d9b619b9bf Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 22 Apr 2014 14:01:51 +0000 Subject: [PATCH] file.c: suppress a warning * file.c (statfs_fsid): use union to suppress strict-aliasing warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/file.c b/file.c index e700478fdf..8fe3796835 100644 --- a/file.c +++ b/file.c @@ -5529,8 +5529,12 @@ statfs_ffree(VALUE self) static VALUE statfs_fsid(VALUE self) { - fsid_t n = get_statfs(self)->f_fsid; - return LL2NUM(*(LONG_LONG*)&n); + union { + uint64_t v; + fsid_t f; + } n = {0}; + n.f = get_statfs(self)->f_fsid; + return LL2NUM(n.v); } #ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME