Skip to content

Commit

Permalink
file.c: use correct integer-conversion function
Browse files Browse the repository at this point in the history
The return value of major() and minor() is unsigned int, not dev_t.
So, UINT2NUM() is a better choice than DEVT2NUM().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
mame committed Oct 23, 2018
1 parent fd35cb4 commit dc2e3f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions file.c
Expand Up @@ -572,7 +572,7 @@ static VALUE
rb_stat_dev_major(VALUE self)
{
#if defined(major)
return DEVT2NUM(major(get_stat(self)->st_dev));
return UINT2NUM(major(get_stat(self)->st_dev));
#else
return Qnil;
#endif
Expand All @@ -593,7 +593,7 @@ static VALUE
rb_stat_dev_minor(VALUE self)
{
#if defined(minor)
return DEVT2NUM(minor(get_stat(self)->st_dev));
return UINT2NUM(minor(get_stat(self)->st_dev));
#else
return Qnil;
#endif
Expand Down Expand Up @@ -731,7 +731,7 @@ static VALUE
rb_stat_rdev_major(VALUE self)
{
#if defined(HAVE_STRUCT_STAT_ST_RDEV) && defined(major)
return DEVT2NUM(major(get_stat(self)->st_rdev));
return UINT2NUM(major(get_stat(self)->st_rdev));
#else
return Qnil;
#endif
Expand All @@ -752,7 +752,7 @@ static VALUE
rb_stat_rdev_minor(VALUE self)
{
#if defined(HAVE_STRUCT_STAT_ST_RDEV) && defined(minor)
return DEVT2NUM(minor(get_stat(self)->st_rdev));
return UINT2NUM(minor(get_stat(self)->st_rdev));
#else
return Qnil;
#endif
Expand Down

0 comments on commit dc2e3f1

Please sign in to comment.