Skip to content

Commit

Permalink
Use constants instead of literals for some fstype calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Jun 4, 2021
1 parent babfc62 commit a56c6d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/zip/filesystem/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def find_entry(filename)

def unix_mode_cmp(filename, mode)
e = find_entry(filename)
e.fstype == 3 && ((e.external_file_attributes >> 16) & mode) != 0
e.fstype == FSTYPE_UNIX && ((e.external_file_attributes >> 16) & mode) != 0
rescue Errno::ENOENT
false
end
Expand Down Expand Up @@ -121,7 +121,7 @@ def chown(owner, group, *filenames)
def chmod(mode, *filenames)
filenames.each do |filename|
e = find_entry(filename)
e.fstype = 3 # force convertion filesystem type to unix
e.fstype = FSTYPE_UNIX # Force conversion filesystem type to unix.
e.unix_perms = mode
e.external_file_attributes = mode << 16
e.dirty = true
Expand Down
2 changes: 1 addition & 1 deletion lib/zip/filesystem/file_stat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def blksize

def mode
e = find_entry
if e.fstype == 3
if e.fstype == FSTYPE_UNIX
e.external_file_attributes >> 16
else
0o100_666 # Equivalent to -rw-rw-rw-.
Expand Down

0 comments on commit a56c6d3

Please sign in to comment.