1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

file.c: use correct integer-conversion function

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
This commit is contained in:
mame 2018-10-23 12:23:04 +00:00
parent fd35cb44b8
commit dc2e3f1ecf

8
file.c
View file

@ -572,7 +572,7 @@ static VALUE
rb_stat_dev_major(VALUE self) rb_stat_dev_major(VALUE self)
{ {
#if defined(major) #if defined(major)
return DEVT2NUM(major(get_stat(self)->st_dev)); return UINT2NUM(major(get_stat(self)->st_dev));
#else #else
return Qnil; return Qnil;
#endif #endif
@ -593,7 +593,7 @@ static VALUE
rb_stat_dev_minor(VALUE self) rb_stat_dev_minor(VALUE self)
{ {
#if defined(minor) #if defined(minor)
return DEVT2NUM(minor(get_stat(self)->st_dev)); return UINT2NUM(minor(get_stat(self)->st_dev));
#else #else
return Qnil; return Qnil;
#endif #endif
@ -731,7 +731,7 @@ static VALUE
rb_stat_rdev_major(VALUE self) rb_stat_rdev_major(VALUE self)
{ {
#if defined(HAVE_STRUCT_STAT_ST_RDEV) && defined(major) #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 #else
return Qnil; return Qnil;
#endif #endif
@ -752,7 +752,7 @@ static VALUE
rb_stat_rdev_minor(VALUE self) rb_stat_rdev_minor(VALUE self)
{ {
#if defined(HAVE_STRUCT_STAT_ST_RDEV) && defined(minor) #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 #else
return Qnil; return Qnil;
#endif #endif