File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
src/main/ruby/truffleruby/core/truffle Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -13,22 +13,22 @@ module DirOperations
13
13
# We don't do this using FFI structs because directory
14
14
# functionality is needed before them and we don't want to
15
15
# duplicate code from the FFI gem.
16
- DIRENT_SIZE = Truffle ::Config [ 'platform.dirent.sizeof' ]
17
- DIRENT_NAME_SIZE = Truffle ::Config [ 'platform.dirent.d_name.size' ]
18
16
DIRENT_NAME_OFFSET = Truffle ::Config [ 'platform.dirent.d_name.offset' ]
19
17
DIRENT_TYPE_OFFSET = Truffle ::Config [ 'platform.dirent.d_type.offset' ]
20
18
21
19
AT_SYMLINK_NOFOLLOW = Truffle ::Config [ 'platform.file.AT_SYMLINK_NOFOLLOW' ]
22
20
DT_DIR = Truffle ::Config [ 'platform.file.DT_DIR' ]
23
21
DT_UNKNOWN = Truffle ::Config [ 'platform.file.DT_UNKNOWN' ]
24
- BUFFER_SIZE = DIRENT_SIZE + Truffle ::FFI ::Pointer ::SIZE
22
+
23
+ NAME_MAX = Truffle ::Config [ 'platform.file.NAME_MAX' ]
24
+
25
25
26
26
def self . readdir ( dir )
27
27
dir . __send__ ( :ensure_open )
28
28
dirptr = dir . instance_variable_get ( :@ptr )
29
29
dirent = Truffle ::POSIX . truffleposix_readdir ( dirptr )
30
30
if !dirent . null?
31
- str = fix_entry_encoding ( dir , dirent . get_string ( DIRENT_NAME_OFFSET , DIRENT_NAME_SIZE ) )
31
+ str = fix_entry_encoding ( dir , dirent . get_string ( DIRENT_NAME_OFFSET , NAME_MAX ) )
32
32
type = ( dirent + DIRENT_TYPE_OFFSET ) . read_uchar
33
33
[ str , type ]
34
34
else
You can’t perform that action at this time.
0 commit comments